@backstage/core-components 0.9.6-next.0 → 0.10.0-next.3
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 +34 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +72 -24
- package/dist/index.esm.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @backstage/core-components
|
|
2
2
|
|
|
3
|
+
## 0.10.0-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7f5e79961d: Fix relative `sub-paths` by concatenating the app's base path with them.
|
|
8
|
+
- a70869e775: Updated dependency `msw` to `^0.43.0`.
|
|
9
|
+
- 693990d4fe: Updated dependency `@react-hookz/web` to `^15.0.0`.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/core-plugin-api@1.0.4-next.0
|
|
12
|
+
|
|
13
|
+
## 0.10.0-next.2
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 32204fa794: Add `transformLinkUri` and `transformImageUri` to `MarkdownContent`
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- b4b711bcc2: Fix the EntityLayout header style so that EntityContextMenu button can display in correct shape when user hover on it
|
|
22
|
+
- 15201b1032: Updated dependency `rc-progress` to `3.4.0`.
|
|
23
|
+
- 385389d23c: Updated to remove usage of the `bursts` object in the theme palette
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @backstage/theme@0.2.16-next.1
|
|
26
|
+
|
|
27
|
+
## 0.9.6-next.1
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- 3c440ea77e: Change BackstageIconLinkVertical style to use pallette instead of explicit color
|
|
32
|
+
- 7e115d42f9: Support displaying subtitle text in `SidebarSubmenuItem`
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
- @backstage/errors@1.1.0-next.0
|
|
35
|
+
- @backstage/theme@0.2.16-next.0
|
|
36
|
+
|
|
3
37
|
## 0.9.6-next.0
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -686,6 +686,8 @@ declare type Props$b = {
|
|
|
686
686
|
content: string;
|
|
687
687
|
dialect?: 'gfm' | 'common-mark';
|
|
688
688
|
linkTarget?: Options['linkTarget'];
|
|
689
|
+
transformLinkUri?: (href: string) => string;
|
|
690
|
+
transformImageUri?: (href: string) => string;
|
|
689
691
|
};
|
|
690
692
|
/**
|
|
691
693
|
* MarkdownContent
|
|
@@ -1504,6 +1506,7 @@ declare type SidebarSubmenuItemDropdownItem = {
|
|
|
1504
1506
|
* Holds submenu item content.
|
|
1505
1507
|
*
|
|
1506
1508
|
* title: Text content of submenu item
|
|
1509
|
+
* subtitle: A subtitle displayed under the main title
|
|
1507
1510
|
* to: Path to navigate to when item is clicked
|
|
1508
1511
|
* icon: Icon displayed on the left of text content
|
|
1509
1512
|
* dropdownItems: Optional array of dropdown items displayed when submenu item is clicked.
|
|
@@ -1512,6 +1515,7 @@ declare type SidebarSubmenuItemDropdownItem = {
|
|
|
1512
1515
|
*/
|
|
1513
1516
|
declare type SidebarSubmenuItemProps = {
|
|
1514
1517
|
title: string;
|
|
1518
|
+
subtitle?: string;
|
|
1515
1519
|
to?: string;
|
|
1516
1520
|
icon?: IconComponent;
|
|
1517
1521
|
dropdownItems?: SidebarSubmenuItemDropdownItem[];
|
package/dist/index.esm.js
CHANGED
|
@@ -3,14 +3,15 @@ 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, useApiHolder,
|
|
6
|
+
import { useApi, alertApiRef, useAnalytics, configApiRef, errorApiRef, storageApiRef, useApp, oauthRequestApiRef, useApiHolder, useElementFilter, attachComponentData, discoveryApiRef } from '@backstage/core-plugin-api';
|
|
7
7
|
import pluralize from 'pluralize';
|
|
8
8
|
import { makeStyles, createStyles, useTheme, darken, lighten, withStyles, styled, ThemeProvider } from '@material-ui/core/styles';
|
|
9
9
|
import MaterialAvatar from '@material-ui/core/Avatar';
|
|
10
10
|
import Button$1 from '@material-ui/core/Button';
|
|
11
11
|
import classNames from 'classnames';
|
|
12
12
|
import Link$1 from '@material-ui/core/Link';
|
|
13
|
-
import { Link as Link$2, useSearchParams, useLocation, useResolvedPath, resolvePath } from 'react-router-dom';
|
|
13
|
+
import { Link as Link$2, useSearchParams, useLocation, useResolvedPath as useResolvedPath$1, resolvePath } from 'react-router-dom';
|
|
14
|
+
import { trimEnd, isEqual, orderBy, isMatch, transform } from 'lodash';
|
|
14
15
|
import Tooltip from '@material-ui/core/Tooltip';
|
|
15
16
|
import CopyIcon from '@material-ui/icons/FileCopy';
|
|
16
17
|
import useCopyToClipboard from 'react-use/lib/useCopyToClipboard';
|
|
@@ -86,7 +87,6 @@ import TableCell from '@material-ui/core/TableCell';
|
|
|
86
87
|
import TableRow from '@material-ui/core/TableRow';
|
|
87
88
|
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
|
88
89
|
import Popover from '@material-ui/core/Popover';
|
|
89
|
-
import { isEqual, orderBy, isMatch, transform } from 'lodash';
|
|
90
90
|
import qs from 'qs';
|
|
91
91
|
import MuiBrokenImageIcon from '@material-ui/icons/BrokenImage';
|
|
92
92
|
import { Helmet } from 'react-helmet';
|
|
@@ -224,6 +224,31 @@ const useStyles$R = makeStyles({
|
|
|
224
224
|
}
|
|
225
225
|
}, { name: "Link" });
|
|
226
226
|
const isExternalUri = (uri) => /^([a-z+.-]+):/.test(uri);
|
|
227
|
+
const useBaseUrl = () => {
|
|
228
|
+
try {
|
|
229
|
+
const config = useApi(configApiRef);
|
|
230
|
+
return config.getOptionalString("app.baseUrl");
|
|
231
|
+
} catch {
|
|
232
|
+
return void 0;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
const useBasePath = () => {
|
|
236
|
+
var _a;
|
|
237
|
+
const base = "http://dummy.dev";
|
|
238
|
+
const url = (_a = useBaseUrl()) != null ? _a : "/";
|
|
239
|
+
const { pathname } = new URL(url, base);
|
|
240
|
+
return trimEnd(pathname, "/");
|
|
241
|
+
};
|
|
242
|
+
const useResolvedPath = (uri) => {
|
|
243
|
+
let resolvedPath = String(uri);
|
|
244
|
+
const basePath = useBasePath();
|
|
245
|
+
const external = isExternalUri(resolvedPath);
|
|
246
|
+
const startsWithBasePath = resolvedPath.startsWith(basePath);
|
|
247
|
+
if (!external && !startsWithBasePath) {
|
|
248
|
+
resolvedPath = basePath.concat(resolvedPath);
|
|
249
|
+
}
|
|
250
|
+
return resolvedPath;
|
|
251
|
+
};
|
|
227
252
|
const getNodeText = (node) => {
|
|
228
253
|
var _a;
|
|
229
254
|
if (node instanceof Array) {
|
|
@@ -240,7 +265,7 @@ const getNodeText = (node) => {
|
|
|
240
265
|
const Link = React.forwardRef(({ onClick, noTrack, ...props }, ref) => {
|
|
241
266
|
const classes = useStyles$R();
|
|
242
267
|
const analytics = useAnalytics();
|
|
243
|
-
const to =
|
|
268
|
+
const to = useResolvedPath(props.to);
|
|
244
269
|
const linkText = getNodeText(props.children) || to;
|
|
245
270
|
const external = isExternalUri(to);
|
|
246
271
|
const newWindow = external && !!/^https?:/.exec(to);
|
|
@@ -251,19 +276,20 @@ const Link = React.forwardRef(({ onClick, noTrack, ...props }, ref) => {
|
|
|
251
276
|
}
|
|
252
277
|
};
|
|
253
278
|
return external ? /* @__PURE__ */ React.createElement(Link$1, {
|
|
279
|
+
...newWindow ? { target: "_blank", rel: "noopener" } : {},
|
|
280
|
+
...props,
|
|
254
281
|
ref,
|
|
255
282
|
href: to,
|
|
256
283
|
onClick: handleClick,
|
|
257
|
-
...newWindow ? { target: "_blank", rel: "noopener" } : {},
|
|
258
|
-
...props,
|
|
259
284
|
className: classNames(classes.externalLink, props.className)
|
|
260
285
|
}, props.children, /* @__PURE__ */ React.createElement("span", {
|
|
261
286
|
className: classes.visuallyHidden
|
|
262
287
|
}, ", Opens in a new window")) : /* @__PURE__ */ React.createElement(Link$1, {
|
|
288
|
+
...props,
|
|
263
289
|
ref,
|
|
264
290
|
component: Link$2,
|
|
265
|
-
|
|
266
|
-
|
|
291
|
+
to,
|
|
292
|
+
onClick: handleClick
|
|
267
293
|
});
|
|
268
294
|
});
|
|
269
295
|
|
|
@@ -1384,7 +1410,7 @@ const useIconStyles = makeStyles((theme) => ({
|
|
|
1384
1410
|
textAlign: "center"
|
|
1385
1411
|
},
|
|
1386
1412
|
disabled: {
|
|
1387
|
-
color:
|
|
1413
|
+
color: theme.palette.text.secondary,
|
|
1388
1414
|
cursor: "default"
|
|
1389
1415
|
},
|
|
1390
1416
|
primary: {
|
|
@@ -1697,14 +1723,22 @@ const components = {
|
|
|
1697
1723
|
}
|
|
1698
1724
|
};
|
|
1699
1725
|
function MarkdownContent(props) {
|
|
1700
|
-
const {
|
|
1726
|
+
const {
|
|
1727
|
+
content,
|
|
1728
|
+
dialect = "gfm",
|
|
1729
|
+
linkTarget,
|
|
1730
|
+
transformLinkUri,
|
|
1731
|
+
transformImageUri
|
|
1732
|
+
} = props;
|
|
1701
1733
|
const classes = useStyles$B();
|
|
1702
1734
|
return /* @__PURE__ */ React.createElement(ReactMarkdown, {
|
|
1703
1735
|
remarkPlugins: dialect === "gfm" ? [gfm] : [],
|
|
1704
1736
|
className: classes.markdown,
|
|
1705
1737
|
children: content,
|
|
1706
1738
|
components,
|
|
1707
|
-
linkTarget
|
|
1739
|
+
linkTarget,
|
|
1740
|
+
transformLinkUri,
|
|
1741
|
+
transformImageUri
|
|
1708
1742
|
});
|
|
1709
1743
|
}
|
|
1710
1744
|
|
|
@@ -3271,13 +3305,13 @@ const useStyles$l = makeStyles((theme) => ({
|
|
|
3271
3305
|
}),
|
|
3272
3306
|
overlayHeader: {
|
|
3273
3307
|
display: "flex",
|
|
3274
|
-
color: theme.palette.
|
|
3308
|
+
color: theme.palette.text.primary,
|
|
3275
3309
|
alignItems: "center",
|
|
3276
3310
|
justifyContent: "space-between",
|
|
3277
3311
|
padding: theme.spacing(2, 3)
|
|
3278
3312
|
},
|
|
3279
3313
|
overlayHeaderClose: {
|
|
3280
|
-
color: theme.palette.
|
|
3314
|
+
color: theme.palette.text.primary
|
|
3281
3315
|
},
|
|
3282
3316
|
marginMobileSidebar: (props) => ({
|
|
3283
3317
|
marginBottom: `${props.sidebarConfig.mobileSidebarHeight}px`
|
|
@@ -3545,6 +3579,13 @@ const useStyles$j = makeStyles((theme) => ({
|
|
|
3545
3579
|
fontSize: 14,
|
|
3546
3580
|
whiteSpace: "nowrap",
|
|
3547
3581
|
overflow: "hidden",
|
|
3582
|
+
"text-overflow": "ellipsis",
|
|
3583
|
+
lineHeight: 1
|
|
3584
|
+
},
|
|
3585
|
+
subtitle: {
|
|
3586
|
+
fontSize: 10,
|
|
3587
|
+
whiteSpace: "nowrap",
|
|
3588
|
+
overflow: "hidden",
|
|
3548
3589
|
"text-overflow": "ellipsis"
|
|
3549
3590
|
},
|
|
3550
3591
|
dropdownArrow: {
|
|
@@ -3575,13 +3616,13 @@ const useStyles$j = makeStyles((theme) => ({
|
|
|
3575
3616
|
}
|
|
3576
3617
|
}), { name: "BackstageSidebarSubmenuItem" });
|
|
3577
3618
|
const SidebarSubmenuItem = (props) => {
|
|
3578
|
-
const { title, to, icon: Icon, dropdownItems } = props;
|
|
3619
|
+
const { title, subtitle, to, icon: Icon, dropdownItems } = props;
|
|
3579
3620
|
const classes = useStyles$j();
|
|
3580
3621
|
const { setIsHoveredOn } = useContext(SidebarItemWithSubmenuContext);
|
|
3581
3622
|
const closeSubmenu = () => {
|
|
3582
3623
|
setIsHoveredOn(false);
|
|
3583
3624
|
};
|
|
3584
|
-
const toLocation = useResolvedPath(to != null ? to : "");
|
|
3625
|
+
const toLocation = useResolvedPath$1(to != null ? to : "");
|
|
3585
3626
|
const currentLocation = useLocation();
|
|
3586
3627
|
let isActive = isLocationMatch(currentLocation, toLocation);
|
|
3587
3628
|
const [showDropDown, setShowDropDown] = useState(false);
|
|
@@ -3609,7 +3650,10 @@ const SidebarSubmenuItem = (props) => {
|
|
|
3609
3650
|
}), /* @__PURE__ */ React.createElement(Typography, {
|
|
3610
3651
|
variant: "subtitle1",
|
|
3611
3652
|
className: classes.label
|
|
3612
|
-
}, title),
|
|
3653
|
+
}, title, /* @__PURE__ */ React.createElement("br", null), subtitle && /* @__PURE__ */ React.createElement(Typography, {
|
|
3654
|
+
variant: "caption",
|
|
3655
|
+
className: classes.subtitle
|
|
3656
|
+
}, subtitle)), showDropDown ? /* @__PURE__ */ React.createElement(ArrowDropUpIcon, {
|
|
3613
3657
|
className: classes.dropdownArrow
|
|
3614
3658
|
}) : /* @__PURE__ */ React.createElement(ArrowDropDownIcon, {
|
|
3615
3659
|
className: classes.dropdownArrow
|
|
@@ -3647,7 +3691,10 @@ const SidebarSubmenuItem = (props) => {
|
|
|
3647
3691
|
}), /* @__PURE__ */ React.createElement(Typography, {
|
|
3648
3692
|
variant: "subtitle1",
|
|
3649
3693
|
className: classes.label
|
|
3650
|
-
}, title)
|
|
3694
|
+
}, title, /* @__PURE__ */ React.createElement("br", null), subtitle && /* @__PURE__ */ React.createElement(Typography, {
|
|
3695
|
+
variant: "caption",
|
|
3696
|
+
className: classes.subtitle
|
|
3697
|
+
}, subtitle)))));
|
|
3651
3698
|
};
|
|
3652
3699
|
|
|
3653
3700
|
const useStyles$i = makeStyles((theme) => ({
|
|
@@ -3925,7 +3972,7 @@ const WorkaroundNavLink = React.forwardRef(function WorkaroundNavLinkWithRef({
|
|
|
3925
3972
|
...rest
|
|
3926
3973
|
}, ref) {
|
|
3927
3974
|
let { pathname: locationPathname } = useLocation();
|
|
3928
|
-
let { pathname: toPathname } = useResolvedPath(to);
|
|
3975
|
+
let { pathname: toPathname } = useResolvedPath$1(to);
|
|
3929
3976
|
if (!caseSensitive) {
|
|
3930
3977
|
locationPathname = locationPathname.toLocaleLowerCase("en-US");
|
|
3931
3978
|
toPathname = toPathname.toLocaleLowerCase("en-US");
|
|
@@ -5335,16 +5382,17 @@ const useStyles$5 = makeStyles((theme) => ({
|
|
|
5335
5382
|
flexGrow: 1
|
|
5336
5383
|
},
|
|
5337
5384
|
rightItemsBox: {
|
|
5338
|
-
width: "auto"
|
|
5385
|
+
width: "auto",
|
|
5386
|
+
alignItems: "center"
|
|
5339
5387
|
},
|
|
5340
5388
|
title: {
|
|
5341
|
-
color: theme.
|
|
5389
|
+
color: theme.page.fontColor,
|
|
5342
5390
|
wordBreak: "break-word",
|
|
5343
5391
|
fontSize: theme.typography.h3.fontSize,
|
|
5344
5392
|
marginBottom: 0
|
|
5345
5393
|
},
|
|
5346
5394
|
subtitle: {
|
|
5347
|
-
color: theme.
|
|
5395
|
+
color: theme.page.fontColor,
|
|
5348
5396
|
opacity: 0.8,
|
|
5349
5397
|
display: "inline-block",
|
|
5350
5398
|
marginTop: theme.spacing(1),
|
|
@@ -5355,10 +5403,10 @@ const useStyles$5 = makeStyles((theme) => ({
|
|
|
5355
5403
|
fontSize: 11,
|
|
5356
5404
|
opacity: 0.8,
|
|
5357
5405
|
marginBottom: theme.spacing(1),
|
|
5358
|
-
color: theme.
|
|
5406
|
+
color: theme.page.fontColor
|
|
5359
5407
|
},
|
|
5360
5408
|
breadcrumb: {
|
|
5361
|
-
color: theme.
|
|
5409
|
+
color: theme.page.fontColor
|
|
5362
5410
|
},
|
|
5363
5411
|
breadcrumbType: {
|
|
5364
5412
|
fontSize: "inherit",
|
|
@@ -5561,7 +5609,7 @@ const styles$1 = (theme) => createStyles({
|
|
|
5561
5609
|
root: {
|
|
5562
5610
|
color: theme.palette.common.white,
|
|
5563
5611
|
padding: theme.spacing(2, 2, 3),
|
|
5564
|
-
backgroundImage: theme.
|
|
5612
|
+
backgroundImage: theme.getPageTheme({ themeId: "card" }).backgroundImage,
|
|
5565
5613
|
backgroundPosition: 0,
|
|
5566
5614
|
backgroundSize: "inherit"
|
|
5567
5615
|
}
|