@backstage/core-components 0.18.10-next.0 → 0.18.10-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,11 @@
|
|
|
1
1
|
# @backstage/core-components
|
|
2
2
|
|
|
3
|
+
## 0.18.10-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 021b368: Added stable DOM markers to the legacy Page and Header so adjacent layout components can coordinate spacing without relying on generated class names.
|
|
8
|
+
|
|
3
9
|
## 0.18.10-next.0
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -155,29 +155,37 @@ function Header(props) {
|
|
|
155
155
|
const defaultTitle = `${documentTitle} | ${appTitle}`;
|
|
156
156
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
157
157
|
/* @__PURE__ */ jsx(Helmet, { titleTemplate, defaultTitle }),
|
|
158
|
-
/* @__PURE__ */ jsxs(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
158
|
+
/* @__PURE__ */ jsxs(
|
|
159
|
+
"header",
|
|
160
|
+
{
|
|
161
|
+
style,
|
|
162
|
+
className: classes.header,
|
|
163
|
+
"data-backstage-core-header": "",
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsxs(Box, { className: classes.leftItemsBox, children: [
|
|
166
|
+
/* @__PURE__ */ jsx(
|
|
167
|
+
TypeFragment,
|
|
168
|
+
{
|
|
169
|
+
classes,
|
|
170
|
+
type,
|
|
171
|
+
typeLink,
|
|
172
|
+
pageTitle
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
TitleFragment,
|
|
177
|
+
{
|
|
178
|
+
classes,
|
|
179
|
+
pageTitle,
|
|
180
|
+
tooltip
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ jsx(SubtitleFragment, { classes, subtitle })
|
|
184
|
+
] }),
|
|
185
|
+
/* @__PURE__ */ jsx(Grid, { container: true, className: classes.rightItemsBox, spacing: 4, children })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
)
|
|
181
189
|
] });
|
|
182
190
|
}
|
|
183
191
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.esm.js","sources":["../../../src/layout/Header/Header.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { CSSProperties, PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { Link } from '../../components/Link';\nimport { Breadcrumbs } from '../Breadcrumbs';\nimport { useContent } from '../Sidebar';\n\n/** @public */\nexport type HeaderClassKey =\n | 'header'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'title'\n | 'subtitle'\n | 'type'\n | 'breadcrumb'\n | 'breadcrumbType'\n | 'breadcrumbTitle';\n\nconst useStyles = makeStyles(\n theme => ({\n header: {\n gridArea: 'pageHeader',\n padding: theme.spacing(3),\n width: '100%',\n boxShadow: theme.shadows[4],\n position: 'relative',\n zIndex: 100,\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n backgroundImage: theme.page.backgroundImage,\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n [theme.breakpoints.down('sm')]: {\n flexWrap: 'wrap',\n },\n },\n leftItemsBox: {\n maxWidth: '100%',\n flexGrow: 1,\n },\n rightItemsBox: {\n width: 'auto',\n alignItems: 'center',\n },\n title: {\n color: theme.page.fontColor,\n wordBreak: 'break-word',\n fontSize: theme.typography.h3.fontSize,\n marginBottom: 0,\n },\n subtitle: {\n color: theme.page.fontColor,\n opacity: 0.8,\n display: 'inline-block', // prevents margin collapse of adjacent siblings\n marginTop: theme.spacing(1),\n maxWidth: '75ch',\n },\n type: {\n textTransform: 'uppercase',\n fontSize: 11,\n opacity: 0.8,\n marginBottom: theme.spacing(1),\n color: theme.page.fontColor,\n },\n breadcrumb: {\n color: theme.page.fontColor,\n },\n breadcrumbType: {\n fontSize: 'inherit',\n opacity: 0.7,\n marginRight: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n breadcrumbTitle: {\n fontSize: 'inherit',\n marginLeft: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n }),\n { name: 'BackstageHeader' },\n);\n\ntype HeaderStyles = ReturnType<typeof useStyles>;\n\ntype Props = {\n component?: ReactNode;\n pageTitleOverride?: string;\n style?: CSSProperties;\n subtitle?: ReactNode;\n title: ReactNode;\n tooltip?: string;\n type?: string;\n typeLink?: string;\n};\n\ntype TypeFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n type?: Props['type'];\n typeLink?: Props['typeLink'];\n};\n\ntype TitleFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n tooltip?: Props['tooltip'];\n};\n\ntype SubtitleFragmentProps = {\n classes: HeaderStyles;\n subtitle?: Props['subtitle'];\n};\n\nconst TypeFragment = ({\n type,\n typeLink,\n classes,\n pageTitle,\n}: TypeFragmentProps) => {\n if (!type) {\n return null;\n }\n\n if (!typeLink) {\n return <Typography className={classes.type}>{type}</Typography>;\n }\n\n return (\n <Breadcrumbs className={classes.breadcrumb}>\n <Link to={typeLink}>{type}</Link>\n <Typography>{pageTitle}</Typography>\n </Breadcrumbs>\n );\n};\n\nconst TitleFragment = ({ pageTitle, classes, tooltip }: TitleFragmentProps) => {\n const { contentRef } = useContent();\n\n const FinalTitle = (\n <Typography\n ref={contentRef}\n tabIndex={-1}\n className={classes.title}\n variant=\"h1\"\n >\n {pageTitle}\n </Typography>\n );\n\n if (!tooltip) {\n return FinalTitle;\n }\n\n return (\n <Tooltip title={tooltip} placement=\"top-start\">\n {FinalTitle}\n </Tooltip>\n );\n};\n\nconst SubtitleFragment = ({ classes, subtitle }: SubtitleFragmentProps) => {\n if (!subtitle) {\n return null;\n }\n\n if (typeof subtitle !== 'string') {\n return <>{subtitle}</>;\n }\n\n return (\n <Typography\n className={classes.subtitle}\n variant=\"subtitle2\"\n component=\"span\"\n >\n {subtitle}\n </Typography>\n );\n};\n/**\n * Backstage main header with abstract color background in multiple variants\n *\n * @public\n *\n */\nexport function Header(props: PropsWithChildren<Props>) {\n const {\n children,\n pageTitleOverride,\n style,\n subtitle,\n title,\n tooltip,\n type,\n typeLink,\n } = props;\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n const documentTitle = pageTitleOverride || title;\n const pageTitle = title || pageTitleOverride;\n const titleTemplate = `${documentTitle} | %s | ${appTitle}`;\n const defaultTitle = `${documentTitle} | ${appTitle}`;\n\n return (\n <>\n <Helmet titleTemplate={titleTemplate} defaultTitle={defaultTitle} />\n <header style={style} className={classes.header}>\n <Box className={classes.leftItemsBox}>\n <TypeFragment\n classes={classes}\n type={type}\n typeLink={typeLink}\n pageTitle={pageTitle}\n />\n <TitleFragment\n classes={classes}\n pageTitle={pageTitle}\n tooltip={tooltip}\n />\n <SubtitleFragment classes={classes} subtitle={subtitle} />\n </Box>\n <Grid container className={classes.rightItemsBox} spacing={4}>\n {children}\n </Grid>\n </header>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,MAAA,EAAQ;AAAA,MACN,QAAA,EAAU,YAAA;AAAA,MACV,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACxB,KAAA,EAAO,MAAA;AAAA,MACP,SAAA,EAAW,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC1B,QAAA,EAAU,UAAA;AAAA,MACV,MAAA,EAAQ,GAAA;AAAA,MACR,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,KAAA;AAAA,MACf,UAAA,EAAY,QAAA;AAAA,MACZ,eAAA,EAAiB,MAAM,IAAA,CAAK,eAAA;AAAA,MAC5B,kBAAA,EAAoB,QAAA;AAAA,MACpB,cAAA,EAAgB,OAAA;AAAA,MAChB,CAAC,KAAA,CAAM,WAAA,CAAY,IAAA,CAAK,IAAI,CAAC,GAAG;AAAA,QAC9B,QAAA,EAAU;AAAA;AACZ,KACF;AAAA,IACA,YAAA,EAAc;AAAA,MACZ,QAAA,EAAU,MAAA;AAAA,MACV,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,aAAA,EAAe;AAAA,MACb,KAAA,EAAO,MAAA;AAAA,MACP,UAAA,EAAY;AAAA,KACd;AAAA,IACA,KAAA,EAAO;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,SAAA;AAAA,MAClB,SAAA,EAAW,YAAA;AAAA,MACX,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,EAAA,CAAG,QAAA;AAAA,MAC9B,YAAA,EAAc;AAAA,KAChB;AAAA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,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,OAAA;AAAA,YACA,SAAA;AAAA,YACA;AAAA;AAAA,SACF;AAAA,wBACA,GAAA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAkB,QAAA,EAAoB;AAAA,OAAA,EAC1D,CAAA;AAAA,sBACA,GAAA,CAAC,QAAK,SAAA,EAAS,IAAA,EAAC,WAAW,OAAA,CAAQ,aAAA,EAAe,OAAA,EAAS,CAAA,EACxD,QAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Header.esm.js","sources":["../../../src/layout/Header/Header.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\nimport Box from '@material-ui/core/Box';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport { CSSProperties, PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { Link } from '../../components/Link';\nimport { Breadcrumbs } from '../Breadcrumbs';\nimport { useContent } from '../Sidebar';\n\n/** @public */\nexport type HeaderClassKey =\n | 'header'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'title'\n | 'subtitle'\n | 'type'\n | 'breadcrumb'\n | 'breadcrumbType'\n | 'breadcrumbTitle';\n\nconst useStyles = makeStyles(\n theme => ({\n header: {\n gridArea: 'pageHeader',\n padding: theme.spacing(3),\n width: '100%',\n boxShadow: theme.shadows[4],\n position: 'relative',\n zIndex: 100,\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n backgroundImage: theme.page.backgroundImage,\n backgroundPosition: 'center',\n backgroundSize: 'cover',\n [theme.breakpoints.down('sm')]: {\n flexWrap: 'wrap',\n },\n },\n leftItemsBox: {\n maxWidth: '100%',\n flexGrow: 1,\n },\n rightItemsBox: {\n width: 'auto',\n alignItems: 'center',\n },\n title: {\n color: theme.page.fontColor,\n wordBreak: 'break-word',\n fontSize: theme.typography.h3.fontSize,\n marginBottom: 0,\n },\n subtitle: {\n color: theme.page.fontColor,\n opacity: 0.8,\n display: 'inline-block', // prevents margin collapse of adjacent siblings\n marginTop: theme.spacing(1),\n maxWidth: '75ch',\n },\n type: {\n textTransform: 'uppercase',\n fontSize: 11,\n opacity: 0.8,\n marginBottom: theme.spacing(1),\n color: theme.page.fontColor,\n },\n breadcrumb: {\n color: theme.page.fontColor,\n },\n breadcrumbType: {\n fontSize: 'inherit',\n opacity: 0.7,\n marginRight: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n breadcrumbTitle: {\n fontSize: 'inherit',\n marginLeft: -theme.spacing(0.3),\n marginBottom: theme.spacing(0.3),\n },\n }),\n { name: 'BackstageHeader' },\n);\n\ntype HeaderStyles = ReturnType<typeof useStyles>;\n\ntype Props = {\n component?: ReactNode;\n pageTitleOverride?: string;\n style?: CSSProperties;\n subtitle?: ReactNode;\n title: ReactNode;\n tooltip?: string;\n type?: string;\n typeLink?: string;\n};\n\ntype TypeFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n type?: Props['type'];\n typeLink?: Props['typeLink'];\n};\n\ntype TitleFragmentProps = {\n classes: HeaderStyles;\n pageTitle: string | ReactNode;\n tooltip?: Props['tooltip'];\n};\n\ntype SubtitleFragmentProps = {\n classes: HeaderStyles;\n subtitle?: Props['subtitle'];\n};\n\nconst TypeFragment = ({\n type,\n typeLink,\n classes,\n pageTitle,\n}: TypeFragmentProps) => {\n if (!type) {\n return null;\n }\n\n if (!typeLink) {\n return <Typography className={classes.type}>{type}</Typography>;\n }\n\n return (\n <Breadcrumbs className={classes.breadcrumb}>\n <Link to={typeLink}>{type}</Link>\n <Typography>{pageTitle}</Typography>\n </Breadcrumbs>\n );\n};\n\nconst TitleFragment = ({ pageTitle, classes, tooltip }: TitleFragmentProps) => {\n const { contentRef } = useContent();\n\n const FinalTitle = (\n <Typography\n ref={contentRef}\n tabIndex={-1}\n className={classes.title}\n variant=\"h1\"\n >\n {pageTitle}\n </Typography>\n );\n\n if (!tooltip) {\n return FinalTitle;\n }\n\n return (\n <Tooltip title={tooltip} placement=\"top-start\">\n {FinalTitle}\n </Tooltip>\n );\n};\n\nconst SubtitleFragment = ({ classes, subtitle }: SubtitleFragmentProps) => {\n if (!subtitle) {\n return null;\n }\n\n if (typeof subtitle !== 'string') {\n return <>{subtitle}</>;\n }\n\n return (\n <Typography\n className={classes.subtitle}\n variant=\"subtitle2\"\n component=\"span\"\n >\n {subtitle}\n </Typography>\n );\n};\n/**\n * Backstage main header with abstract color background in multiple variants\n *\n * @public\n *\n */\nexport function Header(props: PropsWithChildren<Props>) {\n const {\n children,\n pageTitleOverride,\n style,\n subtitle,\n title,\n tooltip,\n type,\n typeLink,\n } = props;\n const classes = useStyles();\n const configApi = useApi(configApiRef);\n const appTitle = configApi.getOptionalString('app.title') || 'Backstage';\n const documentTitle = pageTitleOverride || title;\n const pageTitle = title || pageTitleOverride;\n const titleTemplate = `${documentTitle} | %s | ${appTitle}`;\n const defaultTitle = `${documentTitle} | ${appTitle}`;\n\n return (\n <>\n <Helmet titleTemplate={titleTemplate} defaultTitle={defaultTitle} />\n <header\n style={style}\n className={classes.header}\n data-backstage-core-header=\"\"\n >\n <Box className={classes.leftItemsBox}>\n <TypeFragment\n classes={classes}\n type={type}\n typeLink={typeLink}\n pageTitle={pageTitle}\n />\n <TitleFragment\n classes={classes}\n pageTitle={pageTitle}\n tooltip={tooltip}\n />\n <SubtitleFragment classes={classes} subtitle={subtitle} />\n </Box>\n <Grid container className={classes.rightItemsBox} spacing={4}>\n {children}\n </Grid>\n </header>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,MAAA,EAAQ;AAAA,MACN,QAAA,EAAU,YAAA;AAAA,MACV,OAAA,EAAS,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACxB,KAAA,EAAO,MAAA;AAAA,MACP,SAAA,EAAW,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC1B,QAAA,EAAU,UAAA;AAAA,MACV,MAAA,EAAQ,GAAA;AAAA,MACR,OAAA,EAAS,MAAA;AAAA,MACT,aAAA,EAAe,KAAA;AAAA,MACf,UAAA,EAAY,QAAA;AAAA,MACZ,eAAA,EAAiB,MAAM,IAAA,CAAK,eAAA;AAAA,MAC5B,kBAAA,EAAoB,QAAA;AAAA,MACpB,cAAA,EAAgB,OAAA;AAAA,MAChB,CAAC,KAAA,CAAM,WAAA,CAAY,IAAA,CAAK,IAAI,CAAC,GAAG;AAAA,QAC9B,QAAA,EAAU;AAAA;AACZ,KACF;AAAA,IACA,YAAA,EAAc;AAAA,MACZ,QAAA,EAAU,MAAA;AAAA,MACV,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,aAAA,EAAe;AAAA,MACb,KAAA,EAAO,MAAA;AAAA,MACP,UAAA,EAAY;AAAA,KACd;AAAA,IACA,KAAA,EAAO;AAAA,MACL,KAAA,EAAO,MAAM,IAAA,CAAK,SAAA;AAAA,MAClB,SAAA,EAAW,YAAA;AAAA,MACX,QAAA,EAAU,KAAA,CAAM,UAAA,CAAW,EAAA,CAAG,QAAA;AAAA,MAC9B,YAAA,EAAc;AAAA,KAChB;AAAA,IACA,QAAA,EAAU;AAAA,MACR,KAAA,EAA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AAAA;AAAA,aACF;AAAA,4BACA,GAAA;AAAA,cAAC,aAAA;AAAA,cAAA;AAAA,gBACC,OAAA;AAAA,gBACA,SAAA;AAAA,gBACA;AAAA;AAAA,aACF;AAAA,4BACA,GAAA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAkB,QAAA,EAAoB;AAAA,WAAA,EAC1D,CAAA;AAAA,0BACA,GAAA,CAAC,QAAK,SAAA,EAAS,IAAA,EAAC,WAAW,OAAA,CAAQ,aAAA,EAAe,OAAA,EAAS,CAAA,EACxD,QAAA,EACH;AAAA;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -33,7 +33,14 @@ function Page(props) {
|
|
|
33
33
|
...baseTheme,
|
|
34
34
|
page: baseTheme.getPageTheme({ themeId })
|
|
35
35
|
}),
|
|
36
|
-
children: /* @__PURE__ */ jsx(
|
|
36
|
+
children: /* @__PURE__ */ jsx(
|
|
37
|
+
"main",
|
|
38
|
+
{
|
|
39
|
+
className: classNames(classes.root, className),
|
|
40
|
+
"data-backstage-core-page": "",
|
|
41
|
+
children
|
|
42
|
+
}
|
|
43
|
+
)
|
|
37
44
|
}
|
|
38
45
|
);
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.esm.js","sources":["../../../src/layout/Page/Page.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport { makeStyles, Theme, ThemeProvider } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport type PageClassKey = 'root';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n display: 'grid',\n gridTemplateAreas:\n \"'pageHeader pageHeader pageHeader' 'pageSubheader pageSubheader pageSubheader' 'pageNav pageContent pageSidebar'\",\n gridTemplateRows: 'max-content auto 1fr',\n gridTemplateColumns: 'auto 1fr auto',\n overflowY: 'auto',\n height: '100vh',\n [theme.breakpoints.down('xs')]: {\n height: '100%',\n },\n '@media print': {\n display: 'block',\n height: 'auto',\n overflowY: 'inherit',\n },\n },\n }),\n { name: 'BackstagePage' },\n);\n\ntype Props = {\n themeId: string;\n className?: string;\n children?: ReactNode;\n};\n\nexport function Page(props: Props) {\n const { themeId, className, children } = props;\n const classes = useStyles();\n return (\n <ThemeProvider\n theme={(baseTheme: Theme) => ({\n ...baseTheme,\n page: baseTheme.getPageTheme({ themeId }),\n })}\n >\n <main
|
|
1
|
+
{"version":3,"file":"Page.esm.js","sources":["../../../src/layout/Page/Page.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ReactNode } from 'react';\nimport { makeStyles, Theme, ThemeProvider } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nexport type PageClassKey = 'root';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n display: 'grid',\n gridTemplateAreas:\n \"'pageHeader pageHeader pageHeader' 'pageSubheader pageSubheader pageSubheader' 'pageNav pageContent pageSidebar'\",\n gridTemplateRows: 'max-content auto 1fr',\n gridTemplateColumns: 'auto 1fr auto',\n overflowY: 'auto',\n height: '100vh',\n [theme.breakpoints.down('xs')]: {\n height: '100%',\n },\n '@media print': {\n display: 'block',\n height: 'auto',\n overflowY: 'inherit',\n },\n },\n }),\n { name: 'BackstagePage' },\n);\n\ntype Props = {\n themeId: string;\n className?: string;\n children?: ReactNode;\n};\n\nexport function Page(props: Props) {\n const { themeId, className, children } = props;\n const classes = useStyles();\n return (\n <ThemeProvider\n theme={(baseTheme: Theme) => ({\n ...baseTheme,\n page: baseTheme.getPageTheme({ themeId }),\n })}\n >\n <main\n className={classNames(classes.root, className)}\n data-backstage-core-page=\"\"\n >\n {children}\n </main>\n </ThemeProvider>\n );\n}\n"],"names":[],"mappings":";;;;AAsBA,MAAM,SAAA,GAAY,UAAA;AAAA,EAChB,CAAA,KAAA,MAAU;AAAA,IACR,IAAA,EAAM;AAAA,MACJ,OAAA,EAAS,MAAA;AAAA,MACT,iBAAA,EACE,kHAAA;AAAA,MACF,gBAAA,EAAkB,sBAAA;AAAA,MAClB,mBAAA,EAAqB,eAAA;AAAA,MACrB,SAAA,EAAW,MAAA;AAAA,MACX,MAAA,EAAQ,OAAA;AAAA,MACR,CAAC,KAAA,CAAM,WAAA,CAAY,IAAA,CAAK,IAAI,CAAC,GAAG;AAAA,QAC9B,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,cAAA,EAAgB;AAAA,QACd,OAAA,EAAS,OAAA;AAAA,QACT,MAAA,EAAQ,MAAA;AAAA,QACR,SAAA,EAAW;AAAA;AACb;AACF,GACF,CAAA;AAAA,EACA,EAAE,MAAM,eAAA;AACV,CAAA;AAQO,SAAS,KAAK,KAAA,EAAc;AACjC,EAAA,MAAM,EAAE,OAAA,EAAS,SAAA,EAAW,QAAA,EAAS,GAAI,KAAA;AACzC,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,uBACE,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,CAAC,SAAA,MAAsB;AAAA,QAC5B,GAAG,SAAA;AAAA,QACH,IAAA,EAAM,SAAA,CAAU,YAAA,CAAa,EAAE,SAAS;AAAA,OAC1C,CAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAW,UAAA,CAAW,OAAA,CAAQ,IAAA,EAAM,SAAS,CAAA;AAAA,UAC7C,0BAAA,EAAyB,EAAA;AAAA,UAExB;AAAA;AAAA;AACH;AAAA,GACF;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/core-components",
|
|
3
|
-
"version": "0.18.10-next.
|
|
3
|
+
"version": "0.18.10-next.1",
|
|
4
4
|
"description": "Core components used by Backstage plugins and apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@backstage/config": "1.3.8-next.0",
|
|
70
|
-
"@backstage/core-plugin-api": "1.12.6-next.
|
|
70
|
+
"@backstage/core-plugin-api": "1.12.6-next.1",
|
|
71
71
|
"@backstage/errors": "1.3.1-next.0",
|
|
72
72
|
"@backstage/theme": "0.7.3",
|
|
73
73
|
"@backstage/version-bridge": "1.0.12",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
113
|
"@backstage/app-defaults": "1.7.8-next.0",
|
|
114
|
-
"@backstage/cli": "0.36.2-next.
|
|
114
|
+
"@backstage/cli": "0.36.2-next.1",
|
|
115
115
|
"@backstage/core-app-api": "1.20.1-next.0",
|
|
116
116
|
"@backstage/test-utils": "1.7.18-next.0",
|
|
117
117
|
"@testing-library/dom": "^10.0.0",
|