@backstage/core-components 0.12.5-next.2 → 0.12.6-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @backstage/core-components
2
2
 
3
+ ## 0.12.6-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7908d72e033: Introduce a new global config parameter, `auth.enableExperimentalRedirectFlow`. When enabled, auth will happen with an in-window redirect flow rather than through a popup window.
8
+ - 8e00acb28db: Small tweaks to remove warnings in the console during development (mainly focusing on techdocs)
9
+ - 7245e744ab1: Fixed the font color on `BackstageHeaderLabel` to respect the active page theme.
10
+ - Updated dependencies
11
+ - @backstage/core-plugin-api@1.5.0
12
+ - @backstage/config@1.0.7
13
+ - @backstage/errors@1.1.5
14
+ - @backstage/theme@0.2.18
15
+ - @backstage/version-bridge@1.0.3
16
+
17
+ ## 0.12.5
18
+
19
+ ### Patch Changes
20
+
21
+ - 8bbf95b5507: Button labels in the sidebar (previously displayed in uppercase) will be displayed in the case that is provided without any transformations.
22
+ For example, a sidebar button with the label "Search" will appear as Search, "search" will appear as search, "SEARCH" will appear as SEARCH etc.
23
+ This can potentially affect any overriding styles previously applied to change the appearance of Button labels in the Sidebar.
24
+ - cb8ec97cdeb: Change black & white colors to be theme aware
25
+ - c10384a9235: Switch to using `LinkButton` instead of the deprecated `Button`
26
+ - 52b0022dab7: Updated dependency `msw` to `^1.0.0`.
27
+ - e1aae2f5a0c: Updated the `aria-label` of the `HeaderTabs` component.
28
+ - 6a51a49a810: Fix bug where `<Table />` component would not take into account header styles defined in `columns[*].headerStyle`.
29
+ - fa004f66871: Use media queries to change layout instead of `isMobile` prop in `BackstagePage` component
30
+ - Updated dependencies
31
+ - @backstage/errors@1.1.5
32
+ - @backstage/core-plugin-api@1.5.0
33
+ - @backstage/config@1.0.7
34
+ - @backstage/theme@0.2.18
35
+ - @backstage/version-bridge@1.0.3
36
+
3
37
  ## 0.12.5-next.2
4
38
 
5
39
  ### Patch Changes
package/dist/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import { Alert } from '@material-ui/lab';
7
7
  import pluralize from 'pluralize';
8
8
  import React, { useState, useEffect, useRef, useCallback, useLayoutEffect, lazy, Suspense, useMemo, Component as Component$3, Children, isValidElement, useContext, Fragment, createContext, forwardRef } from 'react';
9
9
  import MaterialAvatar from '@material-ui/core/Avatar';
10
- import { makeStyles, useTheme, darken, lighten, withStyles, createStyles, styled, ThemeProvider } from '@material-ui/core/styles';
10
+ import { makeStyles, useTheme, darken, lighten, withStyles, createStyles, styled, alpha, ThemeProvider } from '@material-ui/core/styles';
11
11
  import Button$1 from '@material-ui/core/Button';
12
12
  import MaterialLink from '@material-ui/core/Link';
13
13
  import classNames from 'classnames';
@@ -2059,9 +2059,12 @@ const useStyles$A = makeStyles(
2059
2059
  { name: "OAuthRequestDialog" }
2060
2060
  );
2061
2061
  function OAuthRequestDialog(_props) {
2062
+ var _a;
2062
2063
  const classes = useStyles$A();
2063
2064
  const [busy, setBusy] = useState(false);
2064
2065
  const oauthRequestApi = useApi(oauthRequestApiRef);
2066
+ const configApi = useApi(configApiRef);
2067
+ const authRedirect = (_a = configApi.getOptionalBoolean("enableExperimentalRedirectFlow")) != null ? _a : false;
2065
2068
  const requests = useObservable(
2066
2069
  useMemo(() => oauthRequestApi.authRequest$(), [oauthRequestApi]),
2067
2070
  []
@@ -2084,7 +2087,8 @@ function OAuthRequestDialog(_props) {
2084
2087
  classes: { root: classes.title },
2085
2088
  id: "oauth-req-dialog-title"
2086
2089
  },
2087
- /* @__PURE__ */ React.createElement(Typography, { className: classes.titleHeading, variant: "h1" }, "Login Required")
2090
+ /* @__PURE__ */ React.createElement(Typography, { className: classes.titleHeading, variant: "h1" }, "Login Required"),
2091
+ authRedirect ? /* @__PURE__ */ React.createElement(Typography, null, "This will trigger a http redirect to OAuth Login.") : null
2088
2092
  ), /* @__PURE__ */ React.createElement(DialogContent, { dividers: true, classes: { root: classes.contentList } }, /* @__PURE__ */ React.createElement(List, null, requests.map((request) => /* @__PURE__ */ React.createElement(
2089
2093
  LoginRequestListItem,
2090
2094
  {
@@ -5141,7 +5145,8 @@ const useTableStyles = makeStyles(
5141
5145
  );
5142
5146
  function convertColumns(columns, theme) {
5143
5147
  return columns.map((column) => {
5144
- const headerStyle = {};
5148
+ var _a;
5149
+ const headerStyle = (_a = column.headerStyle) != null ? _a : {};
5145
5150
  let cellStyle = column.cellStyle || {};
5146
5151
  if (column.highlight) {
5147
5152
  headerStyle.color = theme.palette.textContrast;
@@ -6031,7 +6036,7 @@ const useStyles$4 = makeStyles(
6031
6036
  textAlign: "left"
6032
6037
  },
6033
6038
  label: {
6034
- color: theme.palette.common.white,
6039
+ color: theme.page.fontColor,
6035
6040
  fontWeight: theme.typography.fontWeightBold,
6036
6041
  letterSpacing: 0,
6037
6042
  fontSize: theme.typography.fontSize,
@@ -6039,14 +6044,23 @@ const useStyles$4 = makeStyles(
6039
6044
  lineHeight: 1
6040
6045
  },
6041
6046
  value: {
6042
- color: "rgba(255, 255, 255, 0.8)",
6047
+ color: alpha(theme.page.fontColor, 0.8),
6043
6048
  fontSize: theme.typography.fontSize,
6044
6049
  lineHeight: 1
6045
6050
  }
6046
6051
  }),
6047
6052
  { name: "BackstageHeaderLabel" }
6048
6053
  );
6049
- const HeaderLabelContent = ({ value, className }) => /* @__PURE__ */ React.createElement(Typography, { className }, value);
6054
+ const HeaderLabelContent = ({ value, className }) => {
6055
+ return /* @__PURE__ */ React.createElement(
6056
+ Typography,
6057
+ {
6058
+ component: typeof value === "string" ? "p" : "span",
6059
+ className
6060
+ },
6061
+ value
6062
+ );
6063
+ };
6050
6064
  function HeaderLabel(props) {
6051
6065
  const { label, value, url } = props;
6052
6066
  const classes = useStyles$4();
@@ -6494,16 +6508,23 @@ const GridItem = ({ children }) => {
6494
6508
  return /* @__PURE__ */ React.createElement(Grid, { component: "li", item: true, classes }, children);
6495
6509
  };
6496
6510
 
6497
- const Component$2 = ({ config, onSignInSuccess }) => {
6511
+ const Component$2 = ({
6512
+ config,
6513
+ onSignInStarted,
6514
+ onSignInSuccess,
6515
+ onSignInFailure
6516
+ }) => {
6498
6517
  const { apiRef, title, message } = config;
6499
6518
  const authApi = useApi(apiRef);
6500
6519
  const errorApi = useApi(errorApiRef);
6501
6520
  const handleLogin = async () => {
6502
6521
  try {
6522
+ onSignInStarted();
6503
6523
  const identityResponse = await authApi.getBackstageIdentity({
6504
6524
  instantPopup: true
6505
6525
  });
6506
6526
  if (!identityResponse) {
6527
+ onSignInFailure();
6507
6528
  throw new Error(
6508
6529
  `The ${title} provider is not configured to support sign-in`
6509
6530
  );
@@ -6517,6 +6538,7 @@ const Component$2 = ({ config, onSignInSuccess }) => {
6517
6538
  })
6518
6539
  );
6519
6540
  } catch (error) {
6541
+ onSignInFailure();
6520
6542
  errorApi.post(new ForwardedError("Login failed", error));
6521
6543
  }
6522
6544
  };
@@ -6547,7 +6569,7 @@ const loader$2 = async (apis, apiRef) => {
6547
6569
  };
6548
6570
  const commonProvider = { Component: Component$2, loader: loader$2 };
6549
6571
 
6550
- const Component$1 = ({ onSignInSuccess }) => /* @__PURE__ */ React.createElement(GridItem, null, /* @__PURE__ */ React.createElement(
6572
+ const Component$1 = ({ onSignInStarted, onSignInSuccess }) => /* @__PURE__ */ React.createElement(GridItem, null, /* @__PURE__ */ React.createElement(
6551
6573
  InfoCard,
6552
6574
  {
6553
6575
  title: "Guest",
@@ -6557,7 +6579,10 @@ const Component$1 = ({ onSignInSuccess }) => /* @__PURE__ */ React.createElement
6557
6579
  {
6558
6580
  color: "primary",
6559
6581
  variant: "outlined",
6560
- onClick: () => onSignInSuccess(new GuestUserIdentity())
6582
+ onClick: () => {
6583
+ onSignInStarted();
6584
+ onSignInSuccess(new GuestUserIdentity());
6585
+ }
6561
6586
  },
6562
6587
  "Enter"
6563
6588
  )
@@ -6590,13 +6615,14 @@ const asInputRef = (renderResult) => {
6590
6615
  ...rest
6591
6616
  };
6592
6617
  };
6593
- const Component = ({ onSignInSuccess }) => {
6618
+ const Component = ({ onSignInStarted, onSignInSuccess }) => {
6594
6619
  const classes = useFormStyles();
6595
6620
  const { register, handleSubmit, formState } = useForm({
6596
6621
  mode: "onChange"
6597
6622
  });
6598
6623
  const { errors } = formState;
6599
6624
  const handleResult = ({ userId, idToken }) => {
6625
+ onSignInStarted();
6600
6626
  onSignInSuccess(
6601
6627
  UserIdentity.fromLegacy({
6602
6628
  userId,
@@ -6751,6 +6777,7 @@ const useSignInProviders = (providers, onSignInSuccess) => {
6751
6777
  let didCancel = false;
6752
6778
  provider.components.loader(apiHolder, (_a = provider.config) == null ? void 0 : _a.apiRef).then((result) => {
6753
6779
  if (didCancel) {
6780
+ localStorage.removeItem(PROVIDER_STORAGE_KEY);
6754
6781
  return;
6755
6782
  }
6756
6783
  if (result) {
@@ -6759,10 +6786,10 @@ const useSignInProviders = (providers, onSignInSuccess) => {
6759
6786
  setLoading(false);
6760
6787
  }
6761
6788
  }).catch((error) => {
6789
+ localStorage.removeItem(PROVIDER_STORAGE_KEY);
6762
6790
  if (didCancel) {
6763
6791
  return;
6764
6792
  }
6765
- localStorage.removeItem(PROVIDER_STORAGE_KEY);
6766
6793
  errorApi.post(error);
6767
6794
  setLoading(false);
6768
6795
  });
@@ -6782,15 +6809,22 @@ const useSignInProviders = (providers, onSignInSuccess) => {
6782
6809
  const provider = providers[key];
6783
6810
  const { Component } = provider.components;
6784
6811
  const handleSignInSuccess = (result) => {
6785
- localStorage.setItem(PROVIDER_STORAGE_KEY, provider.id);
6786
6812
  handleWrappedResult(result);
6787
6813
  };
6814
+ const handleSignInStarted = () => {
6815
+ localStorage.setItem(PROVIDER_STORAGE_KEY, provider.config.id);
6816
+ };
6817
+ const handleSignInFailure = () => {
6818
+ localStorage.removeItem(PROVIDER_STORAGE_KEY);
6819
+ };
6788
6820
  return /* @__PURE__ */ React.createElement(
6789
6821
  Component,
6790
6822
  {
6791
6823
  key: provider.id,
6792
6824
  config: provider.config,
6793
- onSignInSuccess: handleSignInSuccess
6825
+ onSignInStarted: handleSignInStarted,
6826
+ onSignInSuccess: handleSignInSuccess,
6827
+ onSignInFailure: handleSignInFailure
6794
6828
  }
6795
6829
  );
6796
6830
  }),