@backstage/core-components 0.9.3 → 0.9.4-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 +11 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.esm.js +28 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @backstage/core-components
|
|
2
2
|
|
|
3
|
+
## 0.9.4-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ac19f82936: Added ARIA landmark <main> to Page component and added ARIA landmark <nav> to DesktopSidebar and Sidebar components
|
|
8
|
+
- c0055ece91: Announce external links to screen readers
|
|
9
|
+
- cfc0f2e5bd: Added optional anchorOrigin alignment prop to AlertDisplay
|
|
10
|
+
- f4380eb602: Add an aria-label to the support button to improve accessibility for screen readers
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/core-plugin-api@1.0.2-next.0
|
|
13
|
+
|
|
3
14
|
## 0.9.3
|
|
4
15
|
|
|
5
16
|
### 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
|
|
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
|
@@ -131,9 +131,10 @@ import { useForm } from 'react-hook-form';
|
|
|
131
131
|
import FormHelperText from '@material-ui/core/FormHelperText';
|
|
132
132
|
import isEmpty from 'lodash/isEmpty';
|
|
133
133
|
|
|
134
|
-
function AlertDisplay(
|
|
134
|
+
function AlertDisplay(props) {
|
|
135
135
|
const [messages, setMessages] = useState([]);
|
|
136
136
|
const alertApi = useApi(alertApiRef);
|
|
137
|
+
const { anchorOrigin = { vertical: "top", horizontal: "center" } } = props;
|
|
137
138
|
useEffect(() => {
|
|
138
139
|
const subscription = alertApi.alert$().subscribe((message) => setMessages((msgs) => msgs.concat(message)));
|
|
139
140
|
return () => {
|
|
@@ -149,7 +150,7 @@ function AlertDisplay(_props) {
|
|
|
149
150
|
};
|
|
150
151
|
return /* @__PURE__ */ React.createElement(Snackbar, {
|
|
151
152
|
open: true,
|
|
152
|
-
anchorOrigin
|
|
153
|
+
anchorOrigin
|
|
153
154
|
}, /* @__PURE__ */ React.createElement(Alert, {
|
|
154
155
|
action: /* @__PURE__ */ React.createElement(IconButton, {
|
|
155
156
|
color: "inherit",
|
|
@@ -178,7 +179,7 @@ function extractInitials(value) {
|
|
|
178
179
|
return (_a = value.match(/\b\w/g)) == null ? void 0 : _a.join("").substring(0, 2);
|
|
179
180
|
}
|
|
180
181
|
|
|
181
|
-
const useStyles$
|
|
182
|
+
const useStyles$S = makeStyles((theme) => createStyles({
|
|
182
183
|
avatar: {
|
|
183
184
|
width: "4rem",
|
|
184
185
|
height: "4rem",
|
|
@@ -190,7 +191,7 @@ const useStyles$R = makeStyles((theme) => createStyles({
|
|
|
190
191
|
}), { name: "BackstageAvatar" });
|
|
191
192
|
function Avatar(props) {
|
|
192
193
|
const { displayName, picture, customStyles } = props;
|
|
193
|
-
const classes = useStyles$
|
|
194
|
+
const classes = useStyles$S();
|
|
194
195
|
return /* @__PURE__ */ React.createElement(MaterialAvatar, {
|
|
195
196
|
alt: displayName,
|
|
196
197
|
src: picture,
|
|
@@ -202,6 +203,17 @@ function Avatar(props) {
|
|
|
202
203
|
}, displayName && extractInitials(displayName));
|
|
203
204
|
}
|
|
204
205
|
|
|
206
|
+
const useStyles$R = makeStyles({
|
|
207
|
+
visuallyHidden: {
|
|
208
|
+
clip: "rect(0 0 0 0)",
|
|
209
|
+
clipPath: "inset(50%)",
|
|
210
|
+
overflow: "hidden",
|
|
211
|
+
position: "absolute",
|
|
212
|
+
whiteSpace: "nowrap",
|
|
213
|
+
height: 1,
|
|
214
|
+
width: 1
|
|
215
|
+
}
|
|
216
|
+
}, { name: "Link" });
|
|
205
217
|
const isExternalUri = (uri) => /^([a-z+.-]+):/.test(uri);
|
|
206
218
|
const getNodeText = (node) => {
|
|
207
219
|
var _a;
|
|
@@ -217,6 +229,7 @@ const getNodeText = (node) => {
|
|
|
217
229
|
return "";
|
|
218
230
|
};
|
|
219
231
|
const Link = React.forwardRef(({ onClick, noTrack, ...props }, ref) => {
|
|
232
|
+
const classes = useStyles$R();
|
|
220
233
|
const analytics = useAnalytics();
|
|
221
234
|
const to = String(props.to);
|
|
222
235
|
const linkText = getNodeText(props.children) || to;
|
|
@@ -234,7 +247,9 @@ const Link = React.forwardRef(({ onClick, noTrack, ...props }, ref) => {
|
|
|
234
247
|
onClick: handleClick,
|
|
235
248
|
...newWindow ? { target: "_blank", rel: "noopener" } : {},
|
|
236
249
|
...props
|
|
237
|
-
}
|
|
250
|
+
}, props.children, /* @__PURE__ */ React.createElement("span", {
|
|
251
|
+
className: classes.visuallyHidden
|
|
252
|
+
}, ", Opens in a new window")) : /* @__PURE__ */ React.createElement(Link$1, {
|
|
238
253
|
ref,
|
|
239
254
|
component: Link$2,
|
|
240
255
|
onClick: handleClick,
|
|
@@ -2940,6 +2955,7 @@ function SupportButton(props) {
|
|
|
2940
2955
|
"data-testid": "support-button"
|
|
2941
2956
|
}, /* @__PURE__ */ React.createElement(HelpIcon, null)) : /* @__PURE__ */ React.createElement(Button$1, {
|
|
2942
2957
|
"data-testid": "support-button",
|
|
2958
|
+
"aria-label": "support",
|
|
2943
2959
|
color: "primary",
|
|
2944
2960
|
onClick: onClickHandler,
|
|
2945
2961
|
startIcon: /* @__PURE__ */ React.createElement(HelpIcon, null)
|
|
@@ -3218,7 +3234,9 @@ const OverlayMenu = ({
|
|
|
3218
3234
|
}, label), /* @__PURE__ */ React.createElement(IconButton, {
|
|
3219
3235
|
onClick: onClose,
|
|
3220
3236
|
classes: { root: classes.overlayHeaderClose }
|
|
3221
|
-
}, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement(Box,
|
|
3237
|
+
}, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement(Box, {
|
|
3238
|
+
component: "nav"
|
|
3239
|
+
}, children));
|
|
3222
3240
|
};
|
|
3223
3241
|
const MobileSidebarContext = createContext({
|
|
3224
3242
|
selectedMenuItemIndex: -1,
|
|
@@ -3257,7 +3275,8 @@ const MobileSidebar = (props) => {
|
|
|
3257
3275
|
onClose: () => setSelectedMenuItemIndex(-1)
|
|
3258
3276
|
}, sidebarGroups[selectedMenuItemIndex] && sidebarGroups[selectedMenuItemIndex].props.children), /* @__PURE__ */ React.createElement(BottomNavigation, {
|
|
3259
3277
|
className: classes.root,
|
|
3260
|
-
"data-testid": "mobile-sidebar-root"
|
|
3278
|
+
"data-testid": "mobile-sidebar-root",
|
|
3279
|
+
component: "nav"
|
|
3261
3280
|
}, sidebarGroups)));
|
|
3262
3281
|
};
|
|
3263
3282
|
|
|
@@ -3360,7 +3379,7 @@ const DesktopSidebar = (props) => {
|
|
|
3360
3379
|
toggleSidebarPinState();
|
|
3361
3380
|
}
|
|
3362
3381
|
};
|
|
3363
|
-
return /* @__PURE__ */ React.createElement("
|
|
3382
|
+
return /* @__PURE__ */ React.createElement("nav", {
|
|
3364
3383
|
style: {}
|
|
3365
3384
|
}, /* @__PURE__ */ React.createElement(A11ySkipSidebar, null), /* @__PURE__ */ React.createElement(SidebarContext.Provider, {
|
|
3366
3385
|
value: { isOpen, setOpen }
|
|
@@ -5513,7 +5532,7 @@ function Page(props) {
|
|
|
5513
5532
|
...baseTheme,
|
|
5514
5533
|
page: baseTheme.getPageTheme({ themeId })
|
|
5515
5534
|
})
|
|
5516
|
-
}, /* @__PURE__ */ React.createElement("
|
|
5535
|
+
}, /* @__PURE__ */ React.createElement("main", {
|
|
5517
5536
|
className: classes.root
|
|
5518
5537
|
}, children));
|
|
5519
5538
|
}
|