@backstage/core-components 0.8.3 → 0.8.4

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,18 @@
1
1
  # @backstage/core-components
2
2
 
3
+ ## 0.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 6415189d99: Add a `ProxiedSignInPage` that can be used e.g. for GCP IAP and AWS ALB
8
+ - de2396da24: Create a short delay when `<SidebarSubmenu/>` is opened
9
+ - 5333451def: Cleaned up API exports
10
+ - e2eb92c109: Updated `ResponseErrorPanel` to not use the deprecated `data` property of `ResponseError`.
11
+ - Updated dependencies
12
+ - @backstage/config@0.1.12
13
+ - @backstage/core-plugin-api@0.5.0
14
+ - @backstage/errors@0.2.0
15
+
3
16
  ## 0.8.3
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ import { BackstagePalette, BackstageTheme } from '@backstage/theme';
13
13
  import { TabProps as TabProps$1 } from '@material-ui/core/Tab';
14
14
  import { Column, MaterialTableProps } from '@material-table/core';
15
15
  import { SparklinesProps, SparklinesLineProps } from 'react-sparklines';
16
- import { IconComponent, ApiRef, ProfileInfoApi, BackstageIdentityApi, SessionApi, SignInPageProps, IdentityApi, SignInResult, BackstageUserIdentity, ProfileInfo } from '@backstage/core-plugin-api';
16
+ import { IconComponent, SignInPageProps, ApiRef, ProfileInfoApi, BackstageIdentityApi, SessionApi, IdentityApi, SignInResult, BackstageUserIdentity, ProfileInfo } from '@backstage/core-plugin-api';
17
17
  import * as _material_ui_styles from '@material-ui/styles';
18
18
  import * as _material_ui_core_styles from '@material-ui/core/styles';
19
19
  import { WithStyles, Theme } from '@material-ui/core/styles';
@@ -70,7 +70,7 @@ declare type LinkProps = LinkProps$1 & LinkProps$2 & {
70
70
  * - Makes the Link use react-router
71
71
  * - Captures Link clicks as analytics events.
72
72
  */
73
- declare const ActualLink: React__default.ForwardRefExoticComponent<Pick<LinkProps, "replace" | "media" | "hidden" | "dir" | "slot" | "style" | "title" | "color" | "underline" | "display" | "translate" | "prefix" | "children" | "key" | "id" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "variant" | "innerRef" | "download" | "href" | "hrefLang" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "noWrap" | "gutterBottom" | "paragraph" | "align" | "variantMapping" | "to" | "state" | "TypographyClasses"> & React__default.RefAttributes<any>>;
73
+ declare const ActualLink: React__default.ForwardRefExoticComponent<Pick<LinkProps, "replace" | "media" | "hidden" | "dir" | "slot" | "style" | "title" | "color" | "underline" | "display" | "translate" | "prefix" | "children" | "key" | "id" | "variant" | "state" | "to" | "href" | "download" | "hrefLang" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "classes" | "innerRef" | "noWrap" | "gutterBottom" | "paragraph" | "align" | "variantMapping" | "TypographyClasses"> & React__default.RefAttributes<any>>;
74
74
 
75
75
  /**
76
76
  * Properties for {@link Button}
@@ -95,7 +95,7 @@ interface CodeSnippetProps {
95
95
  */
96
96
  text: string;
97
97
  /**
98
- * Language used by {@link .text}
98
+ * Language used by {@link CodeSnippetProps.text}
99
99
  */
100
100
  language: string;
101
101
  /**
@@ -325,12 +325,12 @@ declare enum LabelPosition {
325
325
  CENTER = "c"
326
326
  }
327
327
 
328
- type types_d_DependencyEdge<_0> = DependencyEdge<_0>;
329
- type types_d_RenderLabelProps<_0> = RenderLabelProps<_0>;
330
- type types_d_RenderLabelFunction<_0> = RenderLabelFunction<_0>;
331
- type types_d_DependencyNode<_0> = DependencyNode<_0>;
332
- type types_d_RenderNodeProps<_0> = RenderNodeProps<_0>;
333
- type types_d_RenderNodeFunction<_0> = RenderNodeFunction<_0>;
328
+ type types_d_DependencyEdge<T = {}> = DependencyEdge<T>;
329
+ type types_d_RenderLabelProps<T = unknown> = RenderLabelProps<T>;
330
+ type types_d_RenderLabelFunction<T = {}> = RenderLabelFunction<T>;
331
+ type types_d_DependencyNode<T = {}> = DependencyNode<T>;
332
+ type types_d_RenderNodeProps<T = unknown> = RenderNodeProps<T>;
333
+ type types_d_RenderNodeFunction<T = {}> = RenderNodeFunction<T>;
334
334
  type types_d_Direction = Direction;
335
335
  declare const types_d_Direction: typeof Direction;
336
336
  type types_d_Alignment = Alignment;
@@ -1039,14 +1039,18 @@ declare type WarningProps = {
1039
1039
  children?: React__default.ReactNode;
1040
1040
  };
1041
1041
  /**
1042
- * WarningPanel. Show a user friendly error message to a user similar to ErrorPanel except that the warning panel
1043
- * only shows the warning message to the user.
1044
- *
1045
- * @param {string} [severity=warning] Ability to change the severity of the alert.
1046
- * @param {string} [title] A title for the warning. If not supplied, "Warning" will be used.
1047
- * @param {Object} [message] Optional more detailed user-friendly message elaborating on the cause of the error.
1048
- * @param {Object} [children] Objects to provide context, such as a stack trace or detailed error reporting.
1049
- * Will be available inside an unfolded accordion.
1042
+ * WarningPanel. Show a user friendly error message to a user similar to
1043
+ * ErrorPanel except that the warning panel only shows the warning message to
1044
+ * the user.
1045
+ *
1046
+ * @param severity - Ability to change the severity of the alert. Default value
1047
+ * "warning"
1048
+ * @param title - A title for the warning. If not supplied, "Warning" will be
1049
+ * used.
1050
+ * @param message - Optional more detailed user-friendly message elaborating on
1051
+ * the cause of the error.
1052
+ * @param children - Objects to provide context, such as a stack trace or detailed
1053
+ * error reporting. Will be available inside an unfolded accordion.
1050
1054
  */
1051
1055
  declare function WarningPanel(props: WarningProps): JSX.Element;
1052
1056
 
@@ -1235,8 +1239,7 @@ declare type ItemCardProps = {
1235
1239
  * This card type has been deprecated. Instead use plain MUI Card and helpers
1236
1240
  * where appropriate.
1237
1241
  *
1238
- * <code>
1239
- * <!--
1242
+ * ```
1240
1243
  * <Card>
1241
1244
  * <CardMedia>
1242
1245
  * <ItemCardHeader title="My Card" subtitle="neat!" />
@@ -1250,10 +1253,9 @@ declare type ItemCardProps = {
1250
1253
  * </Button>
1251
1254
  * </CardActions>
1252
1255
  * </Card>
1253
- * -->
1254
- * </code>
1256
+ * ```
1255
1257
  *
1256
- * @deprecated Use plain MUI <Card> and composable helpers instead.
1258
+ * @deprecated Use plain MUI `<Card>` and composable helpers instead.
1257
1259
  * @see https://material-ui.com/components/cards/
1258
1260
  */
1259
1261
  declare function ItemCard(props: ItemCardProps): JSX.Element;
@@ -1337,6 +1339,35 @@ declare type PageWithHeaderProps = ComponentProps<typeof Header> & {
1337
1339
  };
1338
1340
  declare function PageWithHeader(props: PropsWithChildren<PageWithHeaderProps>): JSX.Element;
1339
1341
 
1342
+ /**
1343
+ * Props for {@link ProxiedSignInPage}.
1344
+ *
1345
+ * @public
1346
+ */
1347
+ declare type ProxiedSignInPageProps = SignInPageProps & {
1348
+ /**
1349
+ * The provider to use, e.g. "gcp-iap" or "aws-alb". This must correspond to
1350
+ * a properly configured auth provider ID in the auth backend.
1351
+ */
1352
+ provider: string;
1353
+ };
1354
+ /**
1355
+ * A sign-in page that has no user interface of its own. Instead, it relies on
1356
+ * sign-in being performed by a reverse authenticating proxy that Backstage is
1357
+ * deployed behind, and leverages its session handling.
1358
+ *
1359
+ * @remarks
1360
+ *
1361
+ * This sign-in page is useful when you are using products such as Google
1362
+ * Identity-Aware Proxy or AWS Application Load Balancer or similar, to front
1363
+ * your Backstage installation. This sign-in page implementation will silently
1364
+ * and regularly punch through the proxy to the auth backend to refresh your
1365
+ * frontend session information, without requiring user interaction.
1366
+ *
1367
+ * @public
1368
+ */
1369
+ declare const ProxiedSignInPage: (props: ProxiedSignInPageProps) => JSX.Element | null;
1370
+
1340
1371
  declare type SidebarClassKey = 'root' | 'drawer' | 'drawerOpen';
1341
1372
  declare type Props$3 = {
1342
1373
  openDelayMs?: number;
@@ -1703,4 +1734,4 @@ declare type BackstageOverrides = Overrides & {
1703
1734
  [Name in keyof BackstageComponentsNameToClassKey]?: Partial<StyleRules<BackstageComponentsNameToClassKey[Name]>>;
1704
1735
  };
1705
1736
 
1706
- export { AlertDisplay, Avatar, AvatarClassKey, AvatarProps, BackstageContentClassKey, BackstageOverrides, BoldHeaderClassKey, BottomLink, BottomLinkClassKey, BottomLinkProps, Breadcrumbs, BreadcrumbsClickableTextClassKey, BreadcrumbsStyledBoxClassKey, BrokenImageIcon, ActualButton as 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, InfoCard, InfoCardClassKey, InfoCardVariants, IntroCard, ItemCard, ItemCardGrid, ItemCardGridClassKey, ItemCardGridProps, ItemCardHeader, ItemCardHeaderClassKey, ItemCardHeaderProps, Lifecycle, LifecycleClassKey, LinearGauge, ActualLink as Link, LinkProps, LogViewer, LogViewerClassKey, LogViewerProps, LoginRequestListItemClassKey, MarkdownContent, MarkdownContentClassKey, MetadataTableCellClassKey, MetadataTableListClassKey, MetadataTableListItemClassKey, MetadataTableTitleCellClassKey, MicDropClassKey, MissingAnnotationEmptyState, MissingAnnotationEmptyStateClassKey, OAuthRequestDialog, OAuthRequestDialogClassKey, OpenedDropdownClassKey, OverflowTooltip, OverflowTooltipClassKey, Page, PageClassKey, PageWithHeader, Progress, ResponseErrorPanel, ResponseErrorPanelClassKey, RoutedTabs, SIDEBAR_INTRO_LOCAL_STORAGE, SelectComponent as Select, SelectClassKey, SelectInputBaseClassKey, SelectItem, SelectedItems, Sidebar, SidebarClassKey, SidebarContext, SidebarContextType, SidebarDivider, SidebarDividerClassKey, SidebarExpandButton, SidebarIntro, SidebarIntroClassKey, SidebarItem, SidebarItemClassKey, SidebarPage, SidebarPageClassKey, SidebarPinStateContext, SidebarPinStateContextType, 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, SubvalueCell, SubvalueCellClassKey, SupportButton, SupportButtonClassKey, SupportConfig, SupportItem, SupportItemLink, Tab, TabBarClassKey, TabIconClassKey, TabbedCard, TabbedCardClassKey, TabbedLayout, Table, TableClassKey, TableColumn, TableFilter, TableFiltersClassKey, TableHeaderClassKey, TableProps, TableState, TableToolbarClassKey, Tabs, TabsClassKey, TrendLine, UserIcon, UserIdentity, WarningIcon, WarningPanel, WarningPanelClassKey, sidebarConfig, useQueryParamState, useSupportConfig };
1737
+ export { AlertDisplay, Avatar, AvatarClassKey, AvatarProps, BackstageContentClassKey, BackstageOverrides, BoldHeaderClassKey, BottomLink, BottomLinkClassKey, BottomLinkProps, Breadcrumbs, BreadcrumbsClickableTextClassKey, BreadcrumbsStyledBoxClassKey, BrokenImageIcon, ActualButton as 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, InfoCard, InfoCardClassKey, InfoCardVariants, IntroCard, ItemCard, ItemCardGrid, ItemCardGridClassKey, ItemCardGridProps, ItemCardHeader, ItemCardHeaderClassKey, ItemCardHeaderProps, Lifecycle, LifecycleClassKey, LinearGauge, ActualLink as Link, LinkProps, LogViewer, LogViewerClassKey, LogViewerProps, LoginRequestListItemClassKey, MarkdownContent, MarkdownContentClassKey, MetadataTableCellClassKey, MetadataTableListClassKey, MetadataTableListItemClassKey, MetadataTableTitleCellClassKey, MicDropClassKey, MissingAnnotationEmptyState, MissingAnnotationEmptyStateClassKey, 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, SidebarIntro, SidebarIntroClassKey, SidebarItem, SidebarItemClassKey, SidebarPage, SidebarPageClassKey, SidebarPinStateContext, SidebarPinStateContextType, 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, SubvalueCell, SubvalueCellClassKey, SupportButton, SupportButtonClassKey, SupportConfig, SupportItem, SupportItemLink, Tab, TabBarClassKey, TabIconClassKey, TabbedCard, TabbedCardClassKey, TabbedLayout, Table, TableClassKey, TableColumn, TableFilter, TableFiltersClassKey, TableHeaderClassKey, TableProps, TableState, TableToolbarClassKey, Tabs, TabsClassKey, TrendLine, UserIcon, UserIdentity, WarningIcon, WarningPanel, WarningPanelClassKey, sidebarConfig, useQueryParamState, useSupportConfig };
package/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@ import Snackbar from '@material-ui/core/Snackbar';
3
3
  import IconButton from '@material-ui/core/IconButton';
4
4
  import CloseIcon from '@material-ui/icons/Close';
5
5
  import { Alert } from '@material-ui/lab';
6
- import { useApi, alertApiRef, useAnalytics, errorApiRef, storageApiRef, useApp, oauthRequestApiRef, configApiRef, attachComponentData, useElementFilter, useApiHolder } from '@backstage/core-plugin-api';
6
+ import { useApi, alertApiRef, useAnalytics, errorApiRef, storageApiRef, useApp, oauthRequestApiRef, configApiRef, attachComponentData, discoveryApiRef, useElementFilter, useApiHolder } from '@backstage/core-plugin-api';
7
7
  import pluralize from 'pluralize';
8
8
  import { makeStyles, createStyles, useTheme, darken, lighten, withStyles, ThemeProvider, styled } from '@material-ui/core/styles';
9
9
  import MaterialAvatar from '@material-ui/core/Avatar';
@@ -56,7 +56,7 @@ import DialogActions from '@material-ui/core/DialogActions';
56
56
  import DialogContent from '@material-ui/core/DialogContent';
57
57
  import DialogTitle from '@material-ui/core/DialogTitle';
58
58
  import ListItemAvatar from '@material-ui/core/ListItemAvatar';
59
- import { isError, ForwardedError } from '@backstage/errors';
59
+ import { isError, ResponseError, ForwardedError } from '@backstage/errors';
60
60
  import TextTruncate from 'react-text-truncate';
61
61
  import useMountedState from 'react-use/lib/useMountedState';
62
62
  import LinearProgress from '@material-ui/core/LinearProgress';
@@ -114,6 +114,8 @@ import { Sparklines, SparklinesLine } from 'react-sparklines';
114
114
  import MicDropSvgUrl from './layout/ErrorPage/mic-drop.svg';
115
115
  import MaterialBreadcrumbs from '@material-ui/core/Breadcrumbs';
116
116
  import CardMedia from '@material-ui/core/CardMedia';
117
+ import useAsync from 'react-use/lib/useAsync';
118
+ import { z } from 'zod';
117
119
  import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
118
120
  import ArrowBackIosIcon from '@material-ui/icons/ArrowBackIos';
119
121
  import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
@@ -1127,13 +1129,13 @@ function ResponseErrorPanel(props) {
1127
1129
  error
1128
1130
  });
1129
1131
  }
1130
- const { data, cause } = error;
1131
- const { request, response } = data;
1132
+ const { body, cause } = error;
1133
+ const { request, response } = body;
1132
1134
  const errorString = `${response.statusCode}: ${cause.name}`;
1133
1135
  const requestString = request && `${request.method} ${request.url}`;
1134
1136
  const messageString = cause.message.replace(/\\n/g, "\n");
1135
1137
  const stackString = (_a = cause.stack) == null ? void 0 : _a.replace(/\\n/g, "\n");
1136
- const jsonString = JSON.stringify(data, void 0, 2);
1138
+ const jsonString = JSON.stringify(body, void 0, 2);
1137
1139
  return /* @__PURE__ */ React.createElement(ErrorPanel, {
1138
1140
  title: title != null ? title : error.message,
1139
1141
  defaultExpanded,
@@ -4269,6 +4271,153 @@ function PageWithHeader(props) {
4269
4271
  }), children);
4270
4272
  }
4271
4273
 
4274
+ const proxiedSessionSchema = z.object({
4275
+ providerInfo: z.object({}).catchall(z.unknown()).optional(),
4276
+ profile: z.object({
4277
+ email: z.string().optional(),
4278
+ displayName: z.string().optional(),
4279
+ picture: z.string().optional()
4280
+ }),
4281
+ backstageIdentity: z.object({
4282
+ token: z.string(),
4283
+ identity: z.object({
4284
+ type: z.literal("user"),
4285
+ userEntityRef: z.string(),
4286
+ ownershipEntityRefs: z.array(z.string())
4287
+ })
4288
+ })
4289
+ });
4290
+
4291
+ const DEFAULTS = {
4292
+ defaultTokenExpiryMillis: 5 * 60 * 1e3,
4293
+ tokenExpiryMarginMillis: 5 * 60 * 1e3
4294
+ };
4295
+ function tokenToExpiry(jwtToken) {
4296
+ const fallback = new Date(Date.now() + DEFAULTS.defaultTokenExpiryMillis);
4297
+ if (!jwtToken) {
4298
+ return fallback;
4299
+ }
4300
+ const [_header, rawPayload, _signature] = jwtToken.split(".");
4301
+ const payload = JSON.parse(atob(rawPayload));
4302
+ if (typeof payload.exp !== "number") {
4303
+ return fallback;
4304
+ }
4305
+ return new Date(payload.exp * 1e3 - DEFAULTS.tokenExpiryMarginMillis);
4306
+ }
4307
+ class ProxiedSignInIdentity {
4308
+ constructor(options) {
4309
+ this.options = options;
4310
+ this.abortController = new AbortController();
4311
+ this.state = { type: "empty" };
4312
+ }
4313
+ async start() {
4314
+ await this.getSessionAsync();
4315
+ }
4316
+ getUserId() {
4317
+ const { backstageIdentity } = this.getSessionSync();
4318
+ const ref = backstageIdentity.identity.userEntityRef;
4319
+ const match = /^([^:/]+:)?([^:/]+\/)?([^:/]+)$/.exec(ref);
4320
+ if (!match) {
4321
+ throw new TypeError(`Invalid user entity reference "${ref}"`);
4322
+ }
4323
+ return match[3];
4324
+ }
4325
+ async getIdToken() {
4326
+ const session = await this.getSessionAsync();
4327
+ return session.backstageIdentity.token;
4328
+ }
4329
+ getProfile() {
4330
+ const session = this.getSessionSync();
4331
+ return session.profile;
4332
+ }
4333
+ async getProfileInfo() {
4334
+ const session = await this.getSessionAsync();
4335
+ return session.profile;
4336
+ }
4337
+ async getBackstageIdentity() {
4338
+ const session = await this.getSessionAsync();
4339
+ return session.backstageIdentity.identity;
4340
+ }
4341
+ async getCredentials() {
4342
+ const session = await this.getSessionAsync();
4343
+ return {
4344
+ token: session.backstageIdentity.token
4345
+ };
4346
+ }
4347
+ async signOut() {
4348
+ this.abortController.abort();
4349
+ }
4350
+ getSessionSync() {
4351
+ if (this.state.type === "active") {
4352
+ return this.state.session;
4353
+ } else if (this.state.type === "fetching" && this.state.previous) {
4354
+ return this.state.previous;
4355
+ }
4356
+ throw new Error("No session available. Try reloading your browser page.");
4357
+ }
4358
+ async getSessionAsync() {
4359
+ if (this.state.type === "fetching") {
4360
+ return this.state.promise;
4361
+ } else if (this.state.type === "active" && new Date() < this.state.expiresAt) {
4362
+ return this.state.session;
4363
+ }
4364
+ const previous = this.state.type === "active" ? this.state.session : void 0;
4365
+ const promise = this.fetchSession().then((session) => {
4366
+ this.state = {
4367
+ type: "active",
4368
+ session,
4369
+ expiresAt: tokenToExpiry(session.backstageIdentity.token)
4370
+ };
4371
+ return session;
4372
+ }, (error) => {
4373
+ this.state = {
4374
+ type: "failed",
4375
+ error
4376
+ };
4377
+ throw error;
4378
+ });
4379
+ this.state = {
4380
+ type: "fetching",
4381
+ promise,
4382
+ previous
4383
+ };
4384
+ return promise;
4385
+ }
4386
+ async fetchSession() {
4387
+ const baseUrl = await this.options.discoveryApi.getBaseUrl("auth");
4388
+ const response = await fetch(`${baseUrl}/${this.options.provider}/refresh`, {
4389
+ signal: this.abortController.signal,
4390
+ headers: { "x-requested-with": "XMLHttpRequest" },
4391
+ credentials: "include"
4392
+ });
4393
+ if (!response.ok) {
4394
+ throw await ResponseError.fromResponse(response);
4395
+ }
4396
+ return proxiedSessionSchema.parse(await response.json());
4397
+ }
4398
+ }
4399
+
4400
+ const ProxiedSignInPage = (props) => {
4401
+ const discoveryApi = useApi(discoveryApiRef);
4402
+ const { loading, error } = useAsync(async () => {
4403
+ const identity = new ProxiedSignInIdentity({
4404
+ provider: props.provider,
4405
+ discoveryApi
4406
+ });
4407
+ await identity.start();
4408
+ props.onSignInSuccess(identity);
4409
+ }, []);
4410
+ if (loading) {
4411
+ return /* @__PURE__ */ React.createElement(Progress, null);
4412
+ } else if (error) {
4413
+ return /* @__PURE__ */ React.createElement(ErrorPanel, {
4414
+ title: "You do not appear to be signed in. Please try reloading the browser page.",
4415
+ error
4416
+ });
4417
+ }
4418
+ return null;
4419
+ };
4420
+
4272
4421
  const drawerWidthClosed = 72;
4273
4422
  const iconPadding = 24;
4274
4423
  const userBadgePadding = 18;
@@ -4289,16 +4438,7 @@ const sidebarConfig = {
4289
4438
  const submenuConfig = {
4290
4439
  drawerWidthClosed: 0,
4291
4440
  drawerWidthOpen: 202,
4292
- defaultOpenDelayMs: 100,
4293
- defaultCloseDelayMs: 0,
4294
- defaultFadeDuration: 200,
4295
- logoHeight: 32,
4296
- iconContainerWidth: drawerWidthClosed,
4297
- iconSize: drawerWidthClosed - iconPadding * 2,
4298
- iconPadding,
4299
- selectedIndicatorWidth: 3,
4300
- userBadgePadding,
4301
- userBadgeDiameter: drawerWidthClosed - userBadgePadding * 2
4441
+ defaultOpenDelayMs: sidebarConfig.defaultOpenDelayMs + 200
4302
4442
  };
4303
4443
  const SIDEBAR_INTRO_LOCAL_STORAGE = "@backstage/core/sidebar-intro-dismissed";
4304
4444
  const SidebarContext = createContext({
@@ -4699,7 +4839,7 @@ const useStyles$3 = (props) => makeStyles((theme) => {
4699
4839
  scrollbarWidth: "none",
4700
4840
  cursor: "default",
4701
4841
  width: submenuConfig.drawerWidthClosed,
4702
- borderRight: `1px solid #383838`,
4842
+ transitionDelay: `${submenuConfig.defaultOpenDelayMs}ms`,
4703
4843
  "& > *": {
4704
4844
  flexShrink: 0
4705
4845
  },
@@ -4723,9 +4863,13 @@ const SidebarSubmenu = (props) => {
4723
4863
  const left = isOpen ? sidebarConfig.drawerWidthOpen : sidebarConfig.drawerWidthClosed;
4724
4864
  const classes = useStyles$3({ left })();
4725
4865
  const { isHoveredOn } = useContext(SidebarItemWithSubmenuContext);
4866
+ const [isSubmenuOpen, setIsSubmenuOpen] = useState(false);
4867
+ useEffect(() => {
4868
+ setIsSubmenuOpen(isHoveredOn);
4869
+ }, [isHoveredOn]);
4726
4870
  return /* @__PURE__ */ React.createElement("div", {
4727
4871
  className: classNames(classes.drawer, {
4728
- [classes.drawerOpen]: isHoveredOn
4872
+ [classes.drawerOpen]: isSubmenuOpen
4729
4873
  })
4730
4874
  }, /* @__PURE__ */ React.createElement(Typography, {
4731
4875
  variant: "h5",
@@ -5840,5 +5984,5 @@ function CardTab(props) {
5840
5984
  });
5841
5985
  }
5842
5986
 
5843
- export { AlertDisplay, Avatar, BottomLink, Breadcrumbs, BrokenImageIcon, ActualButton as Button, CardTab, CatalogIcon, ChatIcon, CodeSnippet, Content, ContentHeader, CopyTextButton, CreateButton, DashboardIcon, DependencyGraph, types as DependencyGraphTypes, DismissableBanner, DocsIcon, EmailIcon, EmptyState, ErrorBoundary, ErrorPage, ErrorPanel, FeatureCalloutCircular, Gauge, GaugeCard, GitHubIcon, GroupIcon, Header, HeaderIconLinkRow, HeaderLabel, HeaderTabs, HelpIcon, HomepageTimer, HorizontalScrollGrid, InfoCard, IntroCard, ItemCard, ItemCardGrid, ItemCardHeader, Lifecycle, LinearGauge, ActualLink as Link, LogViewer, MarkdownContent, MissingAnnotationEmptyState, OAuthRequestDialog, OverflowTooltip, Page, PageWithHeader, Progress, ResponseErrorPanel, RoutedTabs, SIDEBAR_INTRO_LOCAL_STORAGE, SelectComponent as Select, Sidebar, SidebarContext, SidebarDivider, SidebarExpandButton, SidebarIntro, SidebarItem, SidebarPage, SidebarPinStateContext, SidebarScrollWrapper, SidebarSearchField, SidebarSpace, SidebarSpacer, SidebarSubmenu, SidebarSubmenuItem, SignInPage, SimpleStepper, SimpleStepperStep, StatusAborted, StatusError, StatusOK, StatusPending, StatusRunning, StatusWarning, StructuredMetadataTable, SubvalueCell, SupportButton, TabbedCard, TabbedLayout, Table, Tabs, TrendLine, UserIcon, UserIdentity, WarningIcon, WarningPanel, sidebarConfig, useQueryParamState, useSupportConfig };
5987
+ export { AlertDisplay, Avatar, BottomLink, Breadcrumbs, BrokenImageIcon, ActualButton as Button, CardTab, CatalogIcon, ChatIcon, CodeSnippet, Content, ContentHeader, CopyTextButton, CreateButton, DashboardIcon, DependencyGraph, types as DependencyGraphTypes, DismissableBanner, DocsIcon, EmailIcon, EmptyState, ErrorBoundary, ErrorPage, ErrorPanel, FeatureCalloutCircular, Gauge, GaugeCard, GitHubIcon, GroupIcon, Header, HeaderIconLinkRow, HeaderLabel, HeaderTabs, HelpIcon, HomepageTimer, HorizontalScrollGrid, InfoCard, IntroCard, ItemCard, ItemCardGrid, ItemCardHeader, Lifecycle, LinearGauge, ActualLink as Link, LogViewer, MarkdownContent, MissingAnnotationEmptyState, OAuthRequestDialog, OverflowTooltip, Page, PageWithHeader, Progress, ProxiedSignInPage, ResponseErrorPanel, RoutedTabs, SIDEBAR_INTRO_LOCAL_STORAGE, SelectComponent as Select, Sidebar, SidebarContext, SidebarDivider, SidebarExpandButton, SidebarIntro, SidebarItem, SidebarPage, SidebarPinStateContext, SidebarScrollWrapper, SidebarSearchField, SidebarSpace, SidebarSpacer, SidebarSubmenu, SidebarSubmenuItem, SignInPage, SimpleStepper, SimpleStepperStep, StatusAborted, StatusError, StatusOK, StatusPending, StatusRunning, StatusWarning, StructuredMetadataTable, SubvalueCell, SupportButton, TabbedCard, TabbedLayout, Table, Tabs, TrendLine, UserIcon, UserIdentity, WarningIcon, WarningPanel, sidebarConfig, useQueryParamState, useSupportConfig };
5844
5988
  //# sourceMappingURL=index.esm.js.map