@backstage/core-components 0.16.3-next.0 → 0.16.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @backstage/core-components
2
2
 
3
+ ## 0.16.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 4ec6f7b: Allow passing component for `ContentHeader` description
8
+ - Updated dependencies
9
+ - @backstage/core-plugin-api@1.10.3
10
+ - @backstage/config@1.3.2
11
+ - @backstage/errors@1.2.7
12
+ - @backstage/theme@0.6.3
13
+ - @backstage/version-bridge@1.0.10
14
+
3
15
  ## 0.16.3-next.0
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1338,10 +1338,15 @@ type ContentHeaderTitleProps = {
1338
1338
  title?: string;
1339
1339
  className?: string;
1340
1340
  };
1341
+ type ContentHeaderDescriptionProps = {
1342
+ description?: string;
1343
+ className?: string;
1344
+ };
1341
1345
  type ContentHeaderProps = {
1342
1346
  title?: ContentHeaderTitleProps['title'];
1343
1347
  titleComponent?: ReactNode;
1344
- description?: string;
1348
+ description?: ContentHeaderDescriptionProps['description'];
1349
+ descriptionComponent?: ReactNode;
1345
1350
  textAlign?: 'left' | 'right' | 'center';
1346
1351
  };
1347
1352
  /**
@@ -49,17 +49,37 @@ const ContentHeaderTitle = ({ title, className }) => /* @__PURE__ */ React__defa
49
49
  },
50
50
  title
51
51
  );
52
+ const ContentHeaderDescription = ({
53
+ description,
54
+ className
55
+ }) => description ? /* @__PURE__ */ React__default.createElement(
56
+ Typography,
57
+ {
58
+ variant: "body2",
59
+ className,
60
+ "data-testid": "header-description"
61
+ },
62
+ description
63
+ ) : null;
52
64
  function ContentHeader(props) {
53
65
  const {
54
66
  description,
55
67
  title,
56
68
  titleComponent: TitleComponent = void 0,
57
69
  children,
70
+ descriptionComponent: DescriptionComponent = void 0,
58
71
  textAlign = "left"
59
72
  } = props;
60
73
  const classes = useStyles({ textAlign })();
61
74
  const renderedTitle = TitleComponent ? TitleComponent : /* @__PURE__ */ React__default.createElement(ContentHeaderTitle, { title, className: classes.title });
62
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Helmet, { title }), /* @__PURE__ */ React__default.createElement(Box, { className: classes.container }, /* @__PURE__ */ React__default.createElement(Box, { className: classes.leftItemsBox }, renderedTitle, description && /* @__PURE__ */ React__default.createElement(Typography, { className: classes.description, variant: "body2" }, description)), /* @__PURE__ */ React__default.createElement(Box, { className: classes.rightItemsBox }, children)));
75
+ const renderedDescription = DescriptionComponent ? DescriptionComponent : /* @__PURE__ */ React__default.createElement(
76
+ ContentHeaderDescription,
77
+ {
78
+ description,
79
+ className: classes.description
80
+ }
81
+ );
82
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Helmet, { title }), /* @__PURE__ */ React__default.createElement(Box, { className: classes.container }, /* @__PURE__ */ React__default.createElement(Box, { className: classes.leftItemsBox }, renderedTitle, renderedDescription), /* @__PURE__ */ React__default.createElement(Box, { className: classes.rightItemsBox }, children)));
63
83
  }
64
84
 
65
85
  export { ContentHeader };
@@ -1 +1 @@
1
- {"version":3,"file":"ContentHeader.esm.js","sources":["../../../src/layout/ContentHeader/ContentHeader.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 */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React, { PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\n\n/**\n * TODO: favoriteable capability\n */\n\n/** @public */\nexport type ContentHeaderClassKey =\n | 'container'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'description'\n | 'title';\n\nconst useStyles = (props: ContentHeaderProps) =>\n makeStyles(\n theme => ({\n container: {\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-end',\n alignItems: 'center',\n marginBottom: theme.spacing(2),\n textAlign: props.textAlign,\n },\n leftItemsBox: {\n flex: '1 1 auto',\n minWidth: 0,\n overflow: 'visible',\n },\n rightItemsBox: {\n flex: '0 1 auto',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n marginLeft: theme.spacing(1),\n minWidth: 0,\n overflow: 'visible',\n },\n description: {},\n title: {\n display: 'inline-flex',\n marginBottom: 0,\n },\n }),\n { name: 'BackstageContentHeader' },\n );\n\ntype ContentHeaderTitleProps = {\n title?: string;\n className?: string;\n};\n\nconst ContentHeaderTitle = ({ title, className }: ContentHeaderTitleProps) => (\n <Typography\n variant=\"h4\"\n component=\"h2\"\n className={className}\n data-testid=\"header-title\"\n >\n {title}\n </Typography>\n);\n\ntype ContentHeaderProps = {\n title?: ContentHeaderTitleProps['title'];\n titleComponent?: ReactNode;\n description?: string;\n textAlign?: 'left' | 'right' | 'center';\n};\n\n/**\n * A header at the top inside a {@link Content}.\n *\n * @public\n *\n */\n\nexport function ContentHeader(props: PropsWithChildren<ContentHeaderProps>) {\n const {\n description,\n title,\n titleComponent: TitleComponent = undefined,\n children,\n textAlign = 'left',\n } = props;\n const classes = useStyles({ textAlign })();\n\n const renderedTitle = TitleComponent ? (\n TitleComponent\n ) : (\n <ContentHeaderTitle title={title} className={classes.title} />\n );\n\n return (\n <>\n <Helmet title={title} />\n <Box className={classes.container}>\n <Box className={classes.leftItemsBox}>\n {renderedTitle}\n {description && (\n <Typography className={classes.description} variant=\"body2\">\n {description}\n </Typography>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A;AAAA,IACA,aAAY,EAAA;AAAA,GAAA;AAAA,EAEX;AACH,CAAA;AAiBK,SAAS,cAAc,KAA8C,EAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,WAAA;AAAA,IACA,KAAA;AAAA,IACA,gBAAgB,cAAiB,GAAA,KAAA,CAAA;AAAA,IACjC,QAAA;AAAA,IACA,SAAY,GAAA;AAAA,GACV,GAAA,KAAA;AACJ,EAAA,MAAM,OAAU,GAAA,SAAA,CAAU,EAAE,SAAA,EAAW,CAAE,EAAA;AAEzC,EAAM,MAAA,aAAA,GAAgB,iBACpB,cAEA,mBAAAA,cAAA,CAAA,aAAA,CAAC,sBAAmB,KAAc,EAAA,SAAA,EAAW,QAAQ,KAAO,EAAA,CAAA;AAG9D,EAAA,uBAEIA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,kBAAAA,cAAA,CAAA,aAAA,CAAC,MAAO,EAAA,EAAA,KAAA,EAAc,mBACrBA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,6BACrBA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,SAAW,EAAA,OAAA,CAAQ,gBACrB,aACA,EAAA,WAAA,oBACEA,cAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,OAAA,CAAQ,WAAa,EAAA,OAAA,EAAQ,WACjD,WACH,CAEJ,CACA,kBAAAA,cAAA,CAAA,aAAA,CAAC,OAAI,SAAW,EAAA,OAAA,CAAQ,aAAgB,EAAA,EAAA,QAAS,CACnD,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ContentHeader.esm.js","sources":["../../../src/layout/ContentHeader/ContentHeader.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 */\nimport Box from '@material-ui/core/Box';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport React, { PropsWithChildren, ReactNode } from 'react';\nimport { Helmet } from 'react-helmet';\n\n/**\n * TODO: favoriteable capability\n */\n\n/** @public */\nexport type ContentHeaderClassKey =\n | 'container'\n | 'leftItemsBox'\n | 'rightItemsBox'\n | 'description'\n | 'title';\n\nconst useStyles = (props: ContentHeaderProps) =>\n makeStyles(\n theme => ({\n container: {\n width: '100%',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-end',\n alignItems: 'center',\n marginBottom: theme.spacing(2),\n textAlign: props.textAlign,\n },\n leftItemsBox: {\n flex: '1 1 auto',\n minWidth: 0,\n overflow: 'visible',\n },\n rightItemsBox: {\n flex: '0 1 auto',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n marginLeft: theme.spacing(1),\n minWidth: 0,\n overflow: 'visible',\n },\n description: {},\n title: {\n display: 'inline-flex',\n marginBottom: 0,\n },\n }),\n { name: 'BackstageContentHeader' },\n );\n\ntype ContentHeaderTitleProps = {\n title?: string;\n className?: string;\n};\n\nconst ContentHeaderTitle = ({ title, className }: ContentHeaderTitleProps) => (\n <Typography\n variant=\"h4\"\n component=\"h2\"\n className={className}\n data-testid=\"header-title\"\n >\n {title}\n </Typography>\n);\n\ntype ContentHeaderDescriptionProps = {\n description?: string;\n className?: string;\n};\n\nconst ContentHeaderDescription = ({\n description,\n className,\n}: ContentHeaderDescriptionProps) =>\n description ? (\n <Typography\n variant=\"body2\"\n className={className}\n data-testid=\"header-description\"\n >\n {description}\n </Typography>\n ) : null;\n\ntype ContentHeaderProps = {\n title?: ContentHeaderTitleProps['title'];\n titleComponent?: ReactNode;\n description?: ContentHeaderDescriptionProps['description'];\n descriptionComponent?: ReactNode;\n textAlign?: 'left' | 'right' | 'center';\n};\n\n/**\n * A header at the top inside a {@link Content}.\n *\n * @public\n *\n */\n\nexport function ContentHeader(props: PropsWithChildren<ContentHeaderProps>) {\n const {\n description,\n title,\n titleComponent: TitleComponent = undefined,\n children,\n descriptionComponent: DescriptionComponent = undefined,\n textAlign = 'left',\n } = props;\n const classes = useStyles({ textAlign })();\n\n const renderedTitle = TitleComponent ? (\n TitleComponent\n ) : (\n <ContentHeaderTitle title={title} className={classes.title} />\n );\n\n const renderedDescription = DescriptionComponent ? (\n DescriptionComponent\n ) : (\n <ContentHeaderDescription\n description={description}\n className={classes.description}\n />\n );\n\n return (\n <>\n <Helmet title={title} />\n <Box className={classes.container}>\n <Box className={classes.leftItemsBox}>\n {renderedTitle}\n {renderedDescription}\n </Box>\n <Box className={classes.rightItemsBox}>{children}</Box>\n </Box>\n </>\n );\n}\n"],"names":["React"],"mappings":";;;;;;AAiCA,MAAM,SAAA,GAAY,CAAC,KACjB,KAAA,UAAA;AAAA,EACE,CAAU,KAAA,MAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAO,EAAA,MAAA;AAAA,MACP,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,QAAU,EAAA,MAAA;AAAA,MACV,cAAgB,EAAA,UAAA;AAAA,MAChB,UAAY,EAAA,QAAA;AAAA,MACZ,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC7B,WAAW,KAAM,CAAA;AAAA,KACnB;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,IAAM,EAAA,UAAA;AAAA,MACN,QAAU,EAAA,CAAA;AAAA,MACV,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,aAAe,EAAA;AAAA,MACb,IAAM,EAAA,UAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA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AAA,cAAA,CAAA,aAAA,CAAC,sBAAmB,KAAc,EAAA,SAAA,EAAW,QAAQ,KAAO,EAAA,CAAA;AAG9D,EAAM,MAAA,mBAAA,GAAsB,uBAC1B,oBAEA,mBAAAA,cAAA,CAAA,aAAA;AAAA,IAAC,wBAAA;AAAA,IAAA;AAAA,MACC,WAAA;AAAA,MACA,WAAW,OAAQ,CAAA;AAAA;AAAA,GACrB;AAGF,EACE,uBAAAA,cAAA,CAAA,aAAA,CAAAA,cAAA,CAAA,QAAA,EAAA,IAAA,kBACGA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,KAAc,EAAA,CAAA,+CACrB,GAAI,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,SAAA,EAAA,kBACrBA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,WAAW,OAAQ,CAAA,YAAA,EAAA,EACrB,aACA,EAAA,mBACH,CACA,kBAAAA,cAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,aAAA,EAAA,EAAgB,QAAS,CACnD,CACF,CAAA;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/core-components",
3
- "version": "0.16.3-next.0",
3
+ "version": "0.16.3",
4
4
  "description": "Core components used by Backstage plugins and apps",
5
5
  "backstage": {
6
6
  "role": "web-library"
@@ -66,11 +66,11 @@
66
66
  "test": "backstage-cli package test"
67
67
  },
68
68
  "dependencies": {
69
- "@backstage/config": "1.3.2-next.0",
70
- "@backstage/core-plugin-api": "1.10.3-next.0",
71
- "@backstage/errors": "1.2.7-next.0",
72
- "@backstage/theme": "0.6.3",
73
- "@backstage/version-bridge": "1.0.10",
69
+ "@backstage/config": "^1.3.2",
70
+ "@backstage/core-plugin-api": "^1.10.3",
71
+ "@backstage/errors": "^1.2.7",
72
+ "@backstage/theme": "^0.6.3",
73
+ "@backstage/version-bridge": "^1.0.10",
74
74
  "@date-io/core": "^1.3.13",
75
75
  "@material-table/core": "^3.1.0",
76
76
  "@material-ui/core": "^4.12.2",
@@ -105,10 +105,10 @@
105
105
  "zod": "^3.22.4"
106
106
  },
107
107
  "devDependencies": {
108
- "@backstage/app-defaults": "1.5.16-next.0",
109
- "@backstage/cli": "0.29.5-next.1",
110
- "@backstage/core-app-api": "1.15.4-next.0",
111
- "@backstage/test-utils": "1.7.4-next.0",
108
+ "@backstage/app-defaults": "^1.5.16",
109
+ "@backstage/cli": "^0.29.5",
110
+ "@backstage/core-app-api": "^1.15.4",
111
+ "@backstage/test-utils": "^1.7.4",
112
112
  "@testing-library/dom": "^10.0.0",
113
113
  "@testing-library/jest-dom": "^6.0.0",
114
114
  "@testing-library/user-event": "^14.0.0",