@backstage/core-components 0.7.5 → 0.7.6

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,17 @@
1
1
  # @backstage/core-components
2
2
 
3
+ ## 0.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - e34f174fc5: Added `<SidebarSubmenu>` and `<SidebarSubmenuItem>` to enable building better sidebars. You can check out the storybook for more inspiration and how to get started.
8
+
9
+ Added two new theme props for styling the sidebar too, `navItem.hoverBackground` and `submenu.background`.
10
+
11
+ - Updated dependencies
12
+ - @backstage/theme@0.2.14
13
+ - @backstage/core-plugin-api@0.2.2
14
+
3
15
  ## 0.7.5
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1225,8 +1225,67 @@ declare type SidebarClassKey = 'root' | 'drawer' | 'drawerOpen';
1225
1225
  declare type Props$3 = {
1226
1226
  openDelayMs?: number;
1227
1227
  closeDelayMs?: number;
1228
+ disableExpandOnHover?: boolean;
1228
1229
  };
1229
1230
  declare function Sidebar(props: PropsWithChildren<Props$3>): JSX.Element;
1231
+ /**
1232
+ * A button which allows you to expand the sidebar when clicked.
1233
+ * Use optionally to replace sidebar's expand-on-hover feature with expand-on-click.
1234
+ *
1235
+ * @public
1236
+ */
1237
+ declare const SidebarExpandButton: () => JSX.Element | null;
1238
+
1239
+ /**
1240
+ * Clickable item displayed when submenu item is clicked.
1241
+ * title: Text content of item
1242
+ * to: Path to navigate to when item is clicked
1243
+ *
1244
+ * @public
1245
+ */
1246
+ declare type SidebarSubmenuItemDropdownItem = {
1247
+ title: string;
1248
+ to: string;
1249
+ };
1250
+ /**
1251
+ * Holds submenu item content.
1252
+ *
1253
+ * title: Text content of submenu item
1254
+ * to: Path to navigate to when item is clicked
1255
+ * icon: Icon displayed on the left of text content
1256
+ * dropdownItems: Optional array of dropdown items displayed when submenu item is clicked.
1257
+ *
1258
+ * @public
1259
+ */
1260
+ declare type SidebarSubmenuItemProps = {
1261
+ title: string;
1262
+ to: string;
1263
+ icon: IconComponent;
1264
+ dropdownItems?: SidebarSubmenuItemDropdownItem[];
1265
+ };
1266
+ /**
1267
+ * Item used inside a submenu within the sidebar.
1268
+ *
1269
+ * @public
1270
+ */
1271
+ declare const SidebarSubmenuItem: (props: SidebarSubmenuItemProps) => JSX.Element;
1272
+
1273
+ /**
1274
+ * Holds a title for text Header of a sidebar submenu and children
1275
+ * components to be rendered inside SidebarSubmenu
1276
+ *
1277
+ * @public
1278
+ */
1279
+ declare type SidebarSubmenuProps = {
1280
+ title?: string;
1281
+ children: ReactNode;
1282
+ };
1283
+ /**
1284
+ * Used inside SidebarItem to display an expandable Submenu
1285
+ *
1286
+ * @public
1287
+ */
1288
+ declare const SidebarSubmenu: ({ title, children, }: PropsWithChildren<SidebarSubmenuProps>) => JSX.Element;
1230
1289
 
1231
1290
  declare type SidebarPageClassKey = 'root';
1232
1291
  declare type SidebarPinStateContextType = {
@@ -1241,17 +1300,28 @@ declare type SidebarItemBaseProps = {
1241
1300
  icon: IconComponent;
1242
1301
  text?: string;
1243
1302
  hasNotifications?: boolean;
1244
- children?: ReactNode;
1303
+ disableHighlight?: boolean;
1245
1304
  className?: string;
1246
1305
  };
1247
1306
  declare type SidebarItemButtonProps = SidebarItemBaseProps & {
1248
1307
  onClick: (ev: React__default.MouseEvent) => void;
1308
+ children?: ReactNode;
1249
1309
  };
1250
1310
  declare type SidebarItemLinkProps = SidebarItemBaseProps & {
1251
1311
  to: string;
1252
1312
  onClick?: (ev: React__default.MouseEvent) => void;
1253
1313
  } & NavLinkProps;
1254
- declare type SidebarItemProps = SidebarItemButtonProps | SidebarItemLinkProps;
1314
+ declare type SidebarItemWithSubmenuProps = SidebarItemBaseProps & {
1315
+ to?: string;
1316
+ onClick?: (ev: React__default.MouseEvent) => void;
1317
+ children: ReactNode;
1318
+ };
1319
+ /**
1320
+ * SidebarItem with 'to' property will be a clickable link.
1321
+ * SidebarItem with 'onClick' property and without 'to' property will be a clickable button.
1322
+ * SidebarItem which wraps a SidebarSubmenu will be a clickable button which opens a submenu.
1323
+ */
1324
+ declare type SidebarItemProps = SidebarItemLinkProps | SidebarItemButtonProps | SidebarItemWithSubmenuProps;
1255
1325
  declare const SidebarItem: React__default.ForwardRefExoticComponent<SidebarItemProps & React__default.RefAttributes<any>>;
1256
1326
  declare type SidebarSearchFieldProps = {
1257
1327
  onSearch: (input: string) => void;
@@ -1299,6 +1369,7 @@ declare const sidebarConfig: {
1299
1369
  declare const SIDEBAR_INTRO_LOCAL_STORAGE = "@backstage/core/sidebar-intro-dismissed";
1300
1370
  declare type SidebarContextType = {
1301
1371
  isOpen: boolean;
1372
+ setOpen: (open: boolean) => void;
1302
1373
  };
1303
1374
  declare const SidebarContext: React.Context<SidebarContextType>;
1304
1375
 
@@ -1434,4 +1505,4 @@ declare type BackstageOverrides = Overrides & {
1434
1505
  [Name in keyof BackstageComponentsNameToClassKey]?: Partial<StyleRules<BackstageComponentsNameToClassKey[Name]>>;
1435
1506
  };
1436
1507
 
1437
- 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, 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, Sidebar, SidebarClassKey, SidebarContext, SidebarContextType, SidebarDivider, SidebarIntro, SidebarIntroClassKey, SidebarItem, SidebarItemClassKey, SidebarPage, SidebarPageClassKey, SidebarPinStateContext, SidebarPinStateContextType, SidebarScrollWrapper, SidebarSearchField, SidebarSpace, SidebarSpacer, 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, WarningIcon, WarningPanel, WarningPanelClassKey, sidebarConfig, useQueryParamState, useSupportConfig };
1508
+ 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, 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, Sidebar, SidebarClassKey, SidebarContext, SidebarContextType, SidebarDivider, SidebarExpandButton, SidebarIntro, SidebarIntroClassKey, SidebarItem, SidebarItemClassKey, SidebarPage, SidebarPageClassKey, SidebarPinStateContext, SidebarPinStateContextType, SidebarScrollWrapper, SidebarSearchField, SidebarSpace, SidebarSpacer, 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, WarningIcon, WarningPanel, WarningPanelClassKey, sidebarConfig, useQueryParamState, useSupportConfig };