@backstage/core-components 0.9.3-next.2 → 0.9.4-next.1

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,44 @@
1
1
  # @backstage/core-components
2
2
 
3
+ ## 0.9.4-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 55f68c386a: Enabled select component to be enabled by keyboard
8
+ - ba97b80421: Updated dependency `@types/react-syntax-highlighter` to `^15.0.0`.
9
+ - 2bcb0a0e2b: Sidebar NAV now includes aria-label. Component AboutField now uses h2 variant instead of subtitle2 (font properties unchanged)
10
+ - Updated dependencies
11
+ - @backstage/config@1.0.1-next.0
12
+ - @backstage/core-plugin-api@1.0.2-next.1
13
+
14
+ ## 0.9.4-next.0
15
+
16
+ ### Patch Changes
17
+
18
+ - ac19f82936: Added ARIA landmark <main> to Page component and added ARIA landmark <nav> to DesktopSidebar and Sidebar components
19
+ - c0055ece91: Announce external links to screen readers
20
+ - cfc0f2e5bd: Added optional anchorOrigin alignment prop to AlertDisplay
21
+ - f4380eb602: Add an aria-label to the support button to improve accessibility for screen readers
22
+ - Updated dependencies
23
+ - @backstage/core-plugin-api@1.0.2-next.0
24
+
25
+ ## 0.9.3
26
+
27
+ ### Patch Changes
28
+
29
+ - 7c7919777e: build(deps-dev): bump `@testing-library/react-hooks` from 7.0.2 to 8.0.0
30
+ - 24254fd433: build(deps): bump `@testing-library/user-event` from 13.5.0 to 14.0.0
31
+ - 25b8e8d5b5: Add BackstageTab to overridableComponents so can override styles in a theme
32
+ - 230ad0826f: Bump to using `@types/node` v16
33
+ - 41fd107189: Exported `IdentityProviders` type.
34
+ - a13604b8f7: Adding a name to the core-components Tab styles so can customise in the theme settings
35
+ - 19648d5cf5: fix support config ref to use backstage/backstage
36
+ - d505e43ffc: Fix highlighting of active sidebar items.
37
+ - 72f3dfd05a: Updated ProxiedSignInPageProps docs
38
+ - 7741e47eae: `<Sidebar />` now accepts additional props `sidebarOptions` and `submenuOptions` to allow further customization
39
+ - Updated dependencies
40
+ - @backstage/core-plugin-api@1.0.1
41
+
3
42
  ## 0.9.3-next.2
4
43
 
5
44
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -28,9 +28,16 @@ import { Overrides } from '@material-ui/core/styles/overrides';
28
28
  * @public
29
29
  * @remarks
30
30
  *
31
- * Shown as SnackBar at the top of the page
31
+ * Shown as SnackBar at the center top of the page by default. Configurable with props.
32
32
  */
33
- declare function AlertDisplay(_props: {}): JSX.Element | null;
33
+ declare type AlertDisplayProps = {
34
+ anchorOrigin?: {
35
+ vertical: 'top' | 'bottom';
36
+ horizontal: 'left' | 'center' | 'right';
37
+ };
38
+ };
39
+ /** @public */
40
+ declare function AlertDisplay(props: AlertDisplayProps): JSX.Element | null;
34
41
 
35
42
  /** @public */
36
43
  declare type AvatarClassKey = 'avatar';
@@ -1892,4 +1899,4 @@ declare type BackstageOverrides = Overrides & {
1892
1899
  [Name in keyof BackstageComponentsNameToClassKey]?: Partial<StyleRules<BackstageComponentsNameToClassKey[Name]>>;
1893
1900
  };
1894
1901
 
1895
- export { AlertDisplay, Avatar, AvatarClassKey, AvatarProps, BackstageContentClassKey, BackstageOverrides, BoldHeaderClassKey, BottomLink, BottomLinkClassKey, BottomLinkProps, Breadcrumbs, BreadcrumbsClickableTextClassKey, BreadcrumbsStyledBoxClassKey, BrokenImageIcon, Button, ButtonProps, CardActionsTopRightClassKey, CardTab, CardTabClassKey, CatalogIcon, ChatIcon, ClosedDropdownClassKey, CodeSnippet, CodeSnippetProps, Content, ContentHeader, ContentHeaderClassKey, CopyTextButton, CopyTextButtonProps, CreateButton, CreateButtonProps, CustomProviderClassKey, DashboardIcon, DependencyGraph, DependencyGraphDefaultLabelClassKey, DependencyGraphDefaultNodeClassKey, DependencyGraphEdgeClassKey, DependencyGraphNodeClassKey, DependencyGraphProps, types_d as DependencyGraphTypes, DismissableBanner, DismissableBannerClassKey, DismissbleBannerClassKey, DocsIcon, EmailIcon, EmptyState, EmptyStateClassKey, EmptyStateImageClassKey, ErrorBoundary, ErrorBoundaryProps, ErrorPage, ErrorPageClassKey, ErrorPanel, ErrorPanelClassKey, ErrorPanelProps, FeatureCalloutCircleClassKey, FeatureCalloutCircular, FiltersContainerClassKey, Gauge, GaugeCard, GaugeCardClassKey, GaugeClassKey, GaugeProps, GaugePropsGetColor, GaugePropsGetColorOptions, GitHubIcon, GroupIcon, Header, HeaderClassKey, HeaderIconLinkRow, HeaderIconLinkRowClassKey, HeaderLabel, HeaderLabelClassKey, HeaderTabs, HeaderTabsClassKey, HelpIcon, HomepageTimer, HorizontalScrollGrid, HorizontalScrollGridClassKey, IconLinkVerticalClassKey, IconLinkVerticalProps, IdentityProviders, InfoCard, InfoCardClassKey, InfoCardVariants, IntroCard, ItemCard, ItemCardGrid, ItemCardGridClassKey, ItemCardGridProps, ItemCardHeader, ItemCardHeaderClassKey, ItemCardHeaderProps, Lifecycle, LifecycleClassKey, LinearGauge, Link, LinkProps, LogViewer, LogViewerClassKey, LogViewerProps, LoginRequestListItemClassKey, MarkdownContent, MarkdownContentClassKey, MetadataTableCellClassKey, MetadataTableListClassKey, MetadataTableListItemClassKey, MetadataTableTitleCellClassKey, MicDropClassKey, MissingAnnotationEmptyState, MissingAnnotationEmptyStateClassKey, MobileSidebar, MobileSidebarProps, OAuthRequestDialog, OAuthRequestDialogClassKey, OpenedDropdownClassKey, OverflowTooltip, OverflowTooltipClassKey, Page, PageClassKey, PageWithHeader, Progress, ProxiedSignInPage, ProxiedSignInPageProps, ResponseErrorPanel, ResponseErrorPanelClassKey, RoutedTabs, SIDEBAR_INTRO_LOCAL_STORAGE, SelectComponent as Select, SelectClassKey, SelectInputBaseClassKey, SelectItem, SelectedItems, Sidebar, SidebarClassKey, SidebarContext, SidebarContextType, SidebarDivider, SidebarDividerClassKey, SidebarExpandButton, SidebarGroup, SidebarGroupProps, SidebarIntro, SidebarIntroClassKey, SidebarItem, SidebarItemClassKey, SidebarOptions, SidebarPage, SidebarPageClassKey, SidebarPageProps, SidebarPinStateContext, SidebarPinStateContextType, SidebarProps, SidebarScrollWrapper, SidebarSearchField, SidebarSpace, SidebarSpaceClassKey, SidebarSpacer, SidebarSpacerClassKey, SidebarSubmenu, SidebarSubmenuItem, SidebarSubmenuItemDropdownItem, SidebarSubmenuItemProps, SidebarSubmenuProps, SignInPage, SignInPageClassKey, SignInProviderConfig, SimpleStepper, SimpleStepperFooterClassKey, SimpleStepperStep, SimpleStepperStepClassKey, StatusAborted, StatusClassKey, StatusError, StatusOK, StatusPending, StatusRunning, StatusWarning, StructuredMetadataTable, StructuredMetadataTableListClassKey, StructuredMetadataTableNestedListClassKey, SubmenuOptions, SubvalueCell, SubvalueCellClassKey, SupportButton, SupportButtonClassKey, SupportConfig, SupportItem, SupportItemLink, Tab, TabBarClassKey, TabClassKey, TabIconClassKey, TabbedCard, TabbedCardClassKey, TabbedLayout, Table, TableClassKey, TableColumn, TableFilter, TableFiltersClassKey, TableHeaderClassKey, TableProps, TableState, TableToolbarClassKey, Tabs, TabsClassKey, TrendLine, UserIcon, UserIdentity, WarningIcon, WarningPanel, WarningPanelClassKey, sidebarConfig, useContent, useQueryParamState, useSupportConfig };
1902
+ export { AlertDisplay, AlertDisplayProps, Avatar, AvatarClassKey, AvatarProps, BackstageContentClassKey, BackstageOverrides, BoldHeaderClassKey, BottomLink, BottomLinkClassKey, BottomLinkProps, Breadcrumbs, BreadcrumbsClickableTextClassKey, BreadcrumbsStyledBoxClassKey, BrokenImageIcon, Button, ButtonProps, CardActionsTopRightClassKey, CardTab, CardTabClassKey, CatalogIcon, ChatIcon, ClosedDropdownClassKey, CodeSnippet, CodeSnippetProps, Content, ContentHeader, ContentHeaderClassKey, CopyTextButton, CopyTextButtonProps, CreateButton, CreateButtonProps, CustomProviderClassKey, DashboardIcon, DependencyGraph, DependencyGraphDefaultLabelClassKey, DependencyGraphDefaultNodeClassKey, DependencyGraphEdgeClassKey, DependencyGraphNodeClassKey, DependencyGraphProps, types_d as DependencyGraphTypes, DismissableBanner, DismissableBannerClassKey, DismissbleBannerClassKey, DocsIcon, EmailIcon, EmptyState, EmptyStateClassKey, EmptyStateImageClassKey, ErrorBoundary, ErrorBoundaryProps, ErrorPage, ErrorPageClassKey, ErrorPanel, ErrorPanelClassKey, ErrorPanelProps, FeatureCalloutCircleClassKey, FeatureCalloutCircular, FiltersContainerClassKey, Gauge, GaugeCard, GaugeCardClassKey, GaugeClassKey, GaugeProps, GaugePropsGetColor, GaugePropsGetColorOptions, GitHubIcon, GroupIcon, Header, HeaderClassKey, HeaderIconLinkRow, HeaderIconLinkRowClassKey, HeaderLabel, HeaderLabelClassKey, HeaderTabs, HeaderTabsClassKey, HelpIcon, HomepageTimer, HorizontalScrollGrid, HorizontalScrollGridClassKey, IconLinkVerticalClassKey, IconLinkVerticalProps, IdentityProviders, InfoCard, InfoCardClassKey, InfoCardVariants, IntroCard, ItemCard, ItemCardGrid, ItemCardGridClassKey, ItemCardGridProps, ItemCardHeader, ItemCardHeaderClassKey, ItemCardHeaderProps, Lifecycle, LifecycleClassKey, LinearGauge, Link, LinkProps, LogViewer, LogViewerClassKey, LogViewerProps, LoginRequestListItemClassKey, MarkdownContent, MarkdownContentClassKey, MetadataTableCellClassKey, MetadataTableListClassKey, MetadataTableListItemClassKey, MetadataTableTitleCellClassKey, MicDropClassKey, MissingAnnotationEmptyState, MissingAnnotationEmptyStateClassKey, MobileSidebar, MobileSidebarProps, OAuthRequestDialog, OAuthRequestDialogClassKey, OpenedDropdownClassKey, OverflowTooltip, OverflowTooltipClassKey, Page, PageClassKey, PageWithHeader, Progress, ProxiedSignInPage, ProxiedSignInPageProps, ResponseErrorPanel, ResponseErrorPanelClassKey, RoutedTabs, SIDEBAR_INTRO_LOCAL_STORAGE, SelectComponent as Select, SelectClassKey, SelectInputBaseClassKey, SelectItem, SelectedItems, Sidebar, SidebarClassKey, SidebarContext, SidebarContextType, SidebarDivider, SidebarDividerClassKey, SidebarExpandButton, SidebarGroup, SidebarGroupProps, SidebarIntro, SidebarIntroClassKey, SidebarItem, SidebarItemClassKey, SidebarOptions, SidebarPage, SidebarPageClassKey, SidebarPageProps, SidebarPinStateContext, SidebarPinStateContextType, SidebarProps, SidebarScrollWrapper, SidebarSearchField, SidebarSpace, SidebarSpaceClassKey, SidebarSpacer, SidebarSpacerClassKey, SidebarSubmenu, SidebarSubmenuItem, SidebarSubmenuItemDropdownItem, SidebarSubmenuItemProps, SidebarSubmenuProps, SignInPage, SignInPageClassKey, SignInProviderConfig, SimpleStepper, SimpleStepperFooterClassKey, SimpleStepperStep, SimpleStepperStepClassKey, StatusAborted, StatusClassKey, StatusError, StatusOK, StatusPending, StatusRunning, StatusWarning, StructuredMetadataTable, StructuredMetadataTableListClassKey, StructuredMetadataTableNestedListClassKey, SubmenuOptions, SubvalueCell, SubvalueCellClassKey, SupportButton, SupportButtonClassKey, SupportConfig, SupportItem, SupportItemLink, Tab, TabBarClassKey, TabClassKey, TabIconClassKey, TabbedCard, TabbedCardClassKey, TabbedLayout, Table, TableClassKey, TableColumn, TableFilter, TableFiltersClassKey, TableHeaderClassKey, TableProps, TableState, TableToolbarClassKey, Tabs, TabsClassKey, TrendLine, UserIcon, UserIdentity, WarningIcon, WarningPanel, WarningPanelClassKey, sidebarConfig, useContent, useQueryParamState, useSupportConfig };
package/dist/index.esm.js CHANGED
@@ -71,6 +71,7 @@ import Checkbox from '@material-ui/core/Checkbox';
71
71
  import Chip from '@material-ui/core/Chip';
72
72
  import FormControl from '@material-ui/core/FormControl';
73
73
  import InputBase from '@material-ui/core/InputBase';
74
+ import InputLabel from '@material-ui/core/InputLabel';
74
75
  import MenuItem from '@material-ui/core/MenuItem';
75
76
  import Select from '@material-ui/core/Select';
76
77
  import SvgIcon from '@material-ui/core/SvgIcon';
@@ -131,9 +132,10 @@ import { useForm } from 'react-hook-form';
131
132
  import FormHelperText from '@material-ui/core/FormHelperText';
132
133
  import isEmpty from 'lodash/isEmpty';
133
134
 
134
- function AlertDisplay(_props) {
135
+ function AlertDisplay(props) {
135
136
  const [messages, setMessages] = useState([]);
136
137
  const alertApi = useApi(alertApiRef);
138
+ const { anchorOrigin = { vertical: "top", horizontal: "center" } } = props;
137
139
  useEffect(() => {
138
140
  const subscription = alertApi.alert$().subscribe((message) => setMessages((msgs) => msgs.concat(message)));
139
141
  return () => {
@@ -149,7 +151,7 @@ function AlertDisplay(_props) {
149
151
  };
150
152
  return /* @__PURE__ */ React.createElement(Snackbar, {
151
153
  open: true,
152
- anchorOrigin: { vertical: "top", horizontal: "center" }
154
+ anchorOrigin
153
155
  }, /* @__PURE__ */ React.createElement(Alert, {
154
156
  action: /* @__PURE__ */ React.createElement(IconButton, {
155
157
  color: "inherit",
@@ -178,7 +180,7 @@ function extractInitials(value) {
178
180
  return (_a = value.match(/\b\w/g)) == null ? void 0 : _a.join("").substring(0, 2);
179
181
  }
180
182
 
181
- const useStyles$R = makeStyles((theme) => createStyles({
183
+ const useStyles$S = makeStyles((theme) => createStyles({
182
184
  avatar: {
183
185
  width: "4rem",
184
186
  height: "4rem",
@@ -190,7 +192,7 @@ const useStyles$R = makeStyles((theme) => createStyles({
190
192
  }), { name: "BackstageAvatar" });
191
193
  function Avatar(props) {
192
194
  const { displayName, picture, customStyles } = props;
193
- const classes = useStyles$R();
195
+ const classes = useStyles$S();
194
196
  return /* @__PURE__ */ React.createElement(MaterialAvatar, {
195
197
  alt: displayName,
196
198
  src: picture,
@@ -202,6 +204,17 @@ function Avatar(props) {
202
204
  }, displayName && extractInitials(displayName));
203
205
  }
204
206
 
207
+ const useStyles$R = makeStyles({
208
+ visuallyHidden: {
209
+ clip: "rect(0 0 0 0)",
210
+ clipPath: "inset(50%)",
211
+ overflow: "hidden",
212
+ position: "absolute",
213
+ whiteSpace: "nowrap",
214
+ height: 1,
215
+ width: 1
216
+ }
217
+ }, { name: "Link" });
205
218
  const isExternalUri = (uri) => /^([a-z+.-]+):/.test(uri);
206
219
  const getNodeText = (node) => {
207
220
  var _a;
@@ -217,6 +230,7 @@ const getNodeText = (node) => {
217
230
  return "";
218
231
  };
219
232
  const Link = React.forwardRef(({ onClick, noTrack, ...props }, ref) => {
233
+ const classes = useStyles$R();
220
234
  const analytics = useAnalytics();
221
235
  const to = String(props.to);
222
236
  const linkText = getNodeText(props.children) || to;
@@ -234,7 +248,9 @@ const Link = React.forwardRef(({ onClick, noTrack, ...props }, ref) => {
234
248
  onClick: handleClick,
235
249
  ...newWindow ? { target: "_blank", rel: "noopener" } : {},
236
250
  ...props
237
- }) : /* @__PURE__ */ React.createElement(Link$1, {
251
+ }, props.children, /* @__PURE__ */ React.createElement("span", {
252
+ className: classes.visuallyHidden
253
+ }, ", Opens in a new window")) : /* @__PURE__ */ React.createElement(Link$1, {
238
254
  ref,
239
255
  component: Link$2,
240
256
  onClick: handleClick,
@@ -2249,6 +2265,16 @@ const useStyles$s = makeStyles((theme) => createStyles({
2249
2265
  color: theme.palette.text.primary
2250
2266
  }
2251
2267
  },
2268
+ formLabel: {
2269
+ transform: "initial",
2270
+ fontWeight: "bold",
2271
+ fontSize: 14,
2272
+ fontFamily: theme.typography.fontFamily,
2273
+ color: theme.palette.text.primary,
2274
+ "&.Mui-focused": {
2275
+ color: theme.palette.text.primary
2276
+ }
2277
+ },
2252
2278
  chips: {
2253
2279
  display: "flex",
2254
2280
  flexWrap: "wrap"
@@ -2311,13 +2337,13 @@ function SelectComponent(props) {
2311
2337
  };
2312
2338
  return /* @__PURE__ */ React.createElement("div", {
2313
2339
  className: classes.root
2314
- }, /* @__PURE__ */ React.createElement(Typography, {
2315
- variant: "button"
2316
- }, label), /* @__PURE__ */ React.createElement(ClickAwayListener, {
2340
+ }, /* @__PURE__ */ React.createElement(ClickAwayListener, {
2317
2341
  onClickAway: handleClickAway
2318
2342
  }, /* @__PURE__ */ React.createElement(FormControl, {
2319
2343
  className: classes.formControl
2320
- }, /* @__PURE__ */ React.createElement(Select, {
2344
+ }, /* @__PURE__ */ React.createElement(InputLabel, {
2345
+ className: classes.formLabel
2346
+ }, label), /* @__PURE__ */ React.createElement(Select, {
2321
2347
  value,
2322
2348
  native,
2323
2349
  disabled,
@@ -2328,6 +2354,8 @@ function SelectComponent(props) {
2328
2354
  onClick: handleClick,
2329
2355
  open: isOpen,
2330
2356
  input: /* @__PURE__ */ React.createElement(BootstrapInput, null),
2357
+ label,
2358
+ tabIndex: 0,
2331
2359
  renderValue: (s) => {
2332
2360
  var _a;
2333
2361
  return multiple && value.length !== 0 ? /* @__PURE__ */ React.createElement("div", {
@@ -2940,6 +2968,7 @@ function SupportButton(props) {
2940
2968
  "data-testid": "support-button"
2941
2969
  }, /* @__PURE__ */ React.createElement(HelpIcon, null)) : /* @__PURE__ */ React.createElement(Button$1, {
2942
2970
  "data-testid": "support-button",
2971
+ "aria-label": "support",
2943
2972
  color: "primary",
2944
2973
  onClick: onClickHandler,
2945
2974
  startIcon: /* @__PURE__ */ React.createElement(HelpIcon, null)
@@ -3218,7 +3247,9 @@ const OverlayMenu = ({
3218
3247
  }, label), /* @__PURE__ */ React.createElement(IconButton, {
3219
3248
  onClick: onClose,
3220
3249
  classes: { root: classes.overlayHeaderClose }
3221
- }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement(Box, null, children));
3250
+ }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement(Box, {
3251
+ component: "nav"
3252
+ }, children));
3222
3253
  };
3223
3254
  const MobileSidebarContext = createContext({
3224
3255
  selectedMenuItemIndex: -1,
@@ -3257,7 +3288,8 @@ const MobileSidebar = (props) => {
3257
3288
  onClose: () => setSelectedMenuItemIndex(-1)
3258
3289
  }, sidebarGroups[selectedMenuItemIndex] && sidebarGroups[selectedMenuItemIndex].props.children), /* @__PURE__ */ React.createElement(BottomNavigation, {
3259
3290
  className: classes.root,
3260
- "data-testid": "mobile-sidebar-root"
3291
+ "data-testid": "mobile-sidebar-root",
3292
+ component: "nav"
3261
3293
  }, sidebarGroups)));
3262
3294
  };
3263
3295
 
@@ -3360,8 +3392,9 @@ const DesktopSidebar = (props) => {
3360
3392
  toggleSidebarPinState();
3361
3393
  }
3362
3394
  };
3363
- return /* @__PURE__ */ React.createElement("div", {
3364
- style: {}
3395
+ return /* @__PURE__ */ React.createElement("nav", {
3396
+ style: {},
3397
+ "aria-label": "sidebar nav"
3365
3398
  }, /* @__PURE__ */ React.createElement(A11ySkipSidebar, null), /* @__PURE__ */ React.createElement(SidebarContext.Provider, {
3366
3399
  value: { isOpen, setOpen }
3367
3400
  }, /* @__PURE__ */ React.createElement("div", {
@@ -5513,7 +5546,7 @@ function Page(props) {
5513
5546
  ...baseTheme,
5514
5547
  page: baseTheme.getPageTheme({ themeId })
5515
5548
  })
5516
- }, /* @__PURE__ */ React.createElement("div", {
5549
+ }, /* @__PURE__ */ React.createElement("main", {
5517
5550
  className: classes.root
5518
5551
  }, children));
5519
5552
  }