@backstage/core-components 0.8.7-next.1 → 0.8.7

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/core-components
2
2
 
3
+ ## 0.8.7
4
+
5
+ ### Patch Changes
6
+
7
+ - f7257dff6f: The `<Link />` component now accepts a `noTrack` prop, which prevents the `click` event from being captured by the Analytics API. This can be used if tracking is explicitly not warranted, or in order to use custom link tracking in specific situations.
8
+ - 4c773ed25c: Change subtitle of Header style to use palette.bursts.fontColor
9
+ - f465b63b7f: Fix an issue where changes related to the `MobileSidebar` prevented scrolling pages. Additionally improve the menu of the `MobileSidebar` to not overlay the `BottomNavigation`.
10
+ - 064e750a50: Adding hover message to the Gauge and an info icon to the GaugeCard.
11
+ - a681cb9c2f: Make linkTarget configurable for MarkdownContent component
12
+
3
13
  ## 0.8.7-next.1
4
14
 
5
15
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -766,6 +766,7 @@ declare type Props$9 = {
766
766
  children?: ReactNode;
767
767
  headerStyle?: object;
768
768
  headerProps?: CardHeaderProps;
769
+ icon?: ReactNode;
769
770
  action?: ReactNode;
770
771
  actionsClassName?: string;
771
772
  actions?: ReactNode;
@@ -784,7 +785,7 @@ declare type Props$9 = {
784
785
  declare function InfoCard(props: Props$9): JSX.Element;
785
786
 
786
787
  /** @public */
787
- declare type GaugeClassKey = 'root' | 'overlay' | 'circle' | 'colorUnknown';
788
+ declare type GaugeClassKey = 'root' | 'overlay' | 'description' | 'circle' | 'colorUnknown';
788
789
  /** @public */
789
790
  declare type GaugeProps = {
790
791
  value: number;
@@ -792,6 +793,7 @@ declare type GaugeProps = {
792
793
  inverse?: boolean;
793
794
  unit?: string;
794
795
  max?: number;
796
+ description?: ReactNode;
795
797
  getColor?: GaugePropsGetColor;
796
798
  };
797
799
  /** @public */
@@ -817,6 +819,8 @@ declare type Props$8 = {
817
819
  variant?: InfoCardVariants;
818
820
  /** Progress in % specified as decimal, e.g. "0.23" */
819
821
  progress: number;
822
+ description?: ReactNode;
823
+ icon?: ReactNode;
820
824
  inverse?: boolean;
821
825
  deepLink?: BottomLinkProps;
822
826
  getColor?: GaugePropsGetColor;
package/dist/index.esm.js CHANGED
@@ -1900,7 +1900,10 @@ const useStyles$y = makeStyles((theme) => ({
1900
1900
  },
1901
1901
  headerAvatar: {},
1902
1902
  headerAction: {},
1903
- headerContent: {}
1903
+ headerContent: {},
1904
+ subheader: {
1905
+ display: "flex"
1906
+ }
1904
1907
  }), { name: "BackstageInfoCard" });
1905
1908
  const CardActionsTopRight = withStyles((theme) => ({
1906
1909
  root: {
@@ -1948,6 +1951,7 @@ function InfoCard(props) {
1948
1951
  children,
1949
1952
  headerStyle,
1950
1953
  headerProps,
1954
+ icon,
1951
1955
  action,
1952
1956
  actionsClassName,
1953
1957
  actions,
@@ -1973,6 +1977,13 @@ function InfoCard(props) {
1973
1977
  };
1974
1978
  });
1975
1979
  }
1980
+ const cardSubTitle = () => {
1981
+ return /* @__PURE__ */ React.createElement("div", {
1982
+ className: classes.headerSubheader
1983
+ }, subheader && /* @__PURE__ */ React.createElement("div", {
1984
+ className: classes.subheader
1985
+ }, subheader), icon);
1986
+ };
1976
1987
  const errProps = errorBoundaryProps || (slackChannel ? { slackChannel } : {});
1977
1988
  return /* @__PURE__ */ React.createElement(Card, {
1978
1989
  style: calculatedStyle,
@@ -1989,7 +2000,7 @@ function InfoCard(props) {
1989
2000
  content: classes.headerContent
1990
2001
  },
1991
2002
  title,
1992
- subheader,
2003
+ subheader: cardSubTitle(),
1993
2004
  action,
1994
2005
  style: { ...headerStyle },
1995
2006
  titleTypographyProps,
@@ -2020,6 +2031,15 @@ const useStyles$x = makeStyles((theme) => ({
2020
2031
  fontWeight: "bold",
2021
2032
  color: theme.palette.textContrast
2022
2033
  },
2034
+ description: {
2035
+ fontSize: "100%",
2036
+ top: "50%",
2037
+ left: "50%",
2038
+ transform: "translate(-50%, -50%)",
2039
+ position: "absolute",
2040
+ wordBreak: "break-all",
2041
+ display: "inline-block"
2042
+ },
2023
2043
  circle: {
2024
2044
  width: "80%",
2025
2045
  transform: "translate(10%, 0)"
@@ -2051,16 +2071,35 @@ const getProgressColor = ({
2051
2071
  return palette.status.ok;
2052
2072
  };
2053
2073
  function Gauge(props) {
2074
+ const [hoverRef, setHoverRef] = useState(null);
2054
2075
  const { getColor = getProgressColor } = props;
2055
2076
  const classes = useStyles$x(props);
2056
2077
  const { palette } = useTheme();
2057
- const { value, fractional, inverse, unit, max } = {
2078
+ const { value, fractional, inverse, unit, max, description } = {
2058
2079
  ...defaultGaugeProps,
2059
2080
  ...props
2060
2081
  };
2061
2082
  const asPercentage = fractional ? Math.round(value * max) : value;
2062
2083
  const asActual = max !== 100 ? Math.round(value) : asPercentage;
2084
+ const [isHovering, setIsHovering] = useState(false);
2085
+ useEffect(() => {
2086
+ const node = hoverRef;
2087
+ const handleMouseOver = () => setIsHovering(true);
2088
+ const handleMouseOut = () => setIsHovering(false);
2089
+ if (node && description) {
2090
+ node.addEventListener("mouseenter", handleMouseOver);
2091
+ node.addEventListener("mouseleave", handleMouseOut);
2092
+ return () => {
2093
+ node.removeEventListener("mouseenter", handleMouseOver);
2094
+ node.removeEventListener("mouseleave", handleMouseOut);
2095
+ };
2096
+ }
2097
+ return () => {
2098
+ setIsHovering(false);
2099
+ };
2100
+ }, [description, hoverRef]);
2063
2101
  return /* @__PURE__ */ React.createElement("div", {
2102
+ ref: setHoverRef,
2064
2103
  className: classes.root
2065
2104
  }, /* @__PURE__ */ React.createElement(Circle, {
2066
2105
  strokeLinecap: "butt",
@@ -2069,7 +2108,9 @@ function Gauge(props) {
2069
2108
  trailWidth: 12,
2070
2109
  strokeColor: getColor({ palette, value: asActual, inverse, max }),
2071
2110
  className: classes.circle
2072
- }), /* @__PURE__ */ React.createElement("div", {
2111
+ }), description && isHovering ? /* @__PURE__ */ React.createElement("div", {
2112
+ className: classes.description
2113
+ }, description) : /* @__PURE__ */ React.createElement("div", {
2073
2114
  className: classes.overlay
2074
2115
  }, isNaN(value) ? "N/A" : `${asActual}${unit}`));
2075
2116
  }
@@ -2082,9 +2123,20 @@ const useStyles$w = makeStyles({
2082
2123
  }, { name: "BackstageGaugeCard" });
2083
2124
  function GaugeCard(props) {
2084
2125
  const classes = useStyles$w(props);
2085
- const { title, subheader, progress, inverse, deepLink, variant, getColor } = props;
2126
+ const {
2127
+ title,
2128
+ subheader,
2129
+ progress,
2130
+ inverse,
2131
+ deepLink,
2132
+ description,
2133
+ icon,
2134
+ variant,
2135
+ getColor
2136
+ } = props;
2086
2137
  const gaugeProps = {
2087
2138
  inverse,
2139
+ description,
2088
2140
  getColor,
2089
2141
  value: progress
2090
2142
  };
@@ -2094,7 +2146,8 @@ function GaugeCard(props) {
2094
2146
  title,
2095
2147
  subheader,
2096
2148
  deepLink,
2097
- variant
2149
+ variant,
2150
+ icon
2098
2151
  }, /* @__PURE__ */ React.createElement(Gauge, {
2099
2152
  ...gaugeProps
2100
2153
  })));