@backstage/plugin-home 0.4.14-next.0 → 0.4.16

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,48 @@
1
1
  # @backstage/plugin-home
2
2
 
3
+ ## 0.4.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-components@0.8.10
9
+ - @backstage/plugin-catalog-react@0.7.0
10
+ - @backstage/catalog-model@0.11.0
11
+ - @backstage/core-plugin-api@0.7.0
12
+ - @backstage/plugin-search@0.7.1
13
+
14
+ ## 0.4.15
15
+
16
+ ### Patch Changes
17
+
18
+ - 1ed305728b: Bump `node-fetch` to version 2.6.7 and `cross-fetch` to version 3.1.5
19
+ - c77c5c7eb6: Added `backstage.role` to `package.json`
20
+ - 651b919dbb: Add Renderer support for the HomePageToolkit component.
21
+
22
+ Previously `<HomePageToolkit Renderer={ComponentAccordion} Tools={[]} />` would
23
+ result in the error `can't access property "map", props.tools is undefined`.
24
+ This change adds a context that can pass props down to the HomePageToolkit.
25
+ Also introduced is an `expanded` prop on the `ComponentAccordion` to setting
26
+ the default expanded state. See `In Accordian` story for details.
27
+
28
+ - Updated dependencies
29
+ - @backstage/core-components@0.8.9
30
+ - @backstage/core-plugin-api@0.6.1
31
+ - @backstage/plugin-catalog-react@0.6.15
32
+ - @backstage/plugin-search@0.7.0
33
+ - @backstage/catalog-model@0.10.0
34
+ - @backstage/theme@0.2.15
35
+
36
+ ## 0.4.14
37
+
38
+ ### Patch Changes
39
+
40
+ - a4a777441d: Adds new StarredEntities component responsible for rendering a list of starred entities on the home page
41
+ - Updated dependencies
42
+ - @backstage/core-components@0.8.8
43
+ - @backstage/plugin-search@0.6.2
44
+ - @backstage/plugin-catalog-react@0.6.14
45
+
3
46
  ## 0.4.14-next.0
4
47
 
5
48
  ### Patch Changes
@@ -1,6 +1,24 @@
1
1
  import { Link } from '@backstage/core-components';
2
2
  import { makeStyles, List, ListItemIcon, ListItemText } from '@material-ui/core';
3
- import React from 'react';
3
+ import React, { createContext } from 'react';
4
+
5
+ const Context = createContext(void 0);
6
+ const ContextProvider = ({
7
+ children,
8
+ tools
9
+ }) => {
10
+ const [toolsValue, _setTools] = React.useState(tools);
11
+ const value = {
12
+ tools: toolsValue
13
+ };
14
+ return /* @__PURE__ */ React.createElement(Context.Provider, {
15
+ value
16
+ }, children);
17
+ };
18
+ const useToolkit = () => {
19
+ const value = React.useContext(Context);
20
+ return value;
21
+ };
4
22
 
5
23
  const useStyles = makeStyles((theme) => ({
6
24
  toolkit: {
@@ -28,10 +46,13 @@ const useStyles = makeStyles((theme) => ({
28
46
  }
29
47
  }));
30
48
  const Content = (props) => {
49
+ var _a;
31
50
  const classes = useStyles();
51
+ const toolkit = useToolkit();
52
+ const tools = (_a = toolkit == null ? void 0 : toolkit.tools) != null ? _a : props.tools;
32
53
  return /* @__PURE__ */ React.createElement(List, {
33
54
  className: classes.toolkit
34
- }, props.tools.map((tool) => /* @__PURE__ */ React.createElement(Link, {
55
+ }, tools.map((tool) => /* @__PURE__ */ React.createElement(Link, {
35
56
  key: tool.url,
36
57
  to: tool.url,
37
58
  className: classes.tool
@@ -43,5 +64,5 @@ const Content = (props) => {
43
64
  }))));
44
65
  };
45
66
 
46
- export { Content };
47
- //# sourceMappingURL=index-e6d55b70.esm.js.map
67
+ export { Content, ContextProvider };
68
+ //# sourceMappingURL=index-75392e0a.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-75392e0a.esm.js","sources":["../../src/homePageComponents/Toolkit/Context.tsx","../../src/homePageComponents/Toolkit/Content.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 React, { createContext } from 'react';\n\nexport type Tool = {\n label: string;\n url: string;\n icon: React.ReactNode;\n};\n\ntype ToolkitContextValue = {\n tools: Tool[];\n};\n\nconst Context = createContext<ToolkitContextValue | undefined>(undefined);\n\nexport const ContextProvider = ({\n children,\n tools,\n}: {\n children: JSX.Element;\n tools: Tool[];\n}) => {\n const [toolsValue, _setTools] = React.useState(tools);\n\n const value: ToolkitContextValue = {\n tools: toolsValue,\n };\n\n return <Context.Provider value={value}>{children}</Context.Provider>;\n};\n\nexport const useToolkit = () => {\n const value = React.useContext(Context);\n return value;\n};\n\nexport default Context;\n","/*\n * Copyright 2021 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 { Link } from '@backstage/core-components';\nimport {\n makeStyles,\n List,\n ListItemIcon,\n ListItemText,\n} from '@material-ui/core';\nimport React from 'react';\nimport { useToolkit, Tool } from './Context';\n\nconst useStyles = makeStyles(theme => ({\n toolkit: {\n display: 'flex',\n flexWrap: 'wrap',\n textAlign: 'center',\n },\n tool: {\n margin: theme.spacing(0.5, 1),\n },\n label: {\n marginTop: theme.spacing(1),\n fontSize: '0.9em',\n lineHeight: '1.25',\n color: theme.palette.text.secondary,\n },\n icon: {\n width: '64px',\n height: '64px',\n borderRadius: '50px',\n justifyContent: 'center',\n alignItems: 'center',\n boxShadow: theme.shadows[1],\n backgroundColor: theme.palette.background.default,\n },\n}));\n\n/**\n * Props for Toolkit content component {@link Content}.\n *\n * @public\n */\nexport type ToolkitContentProps = {\n tools: Tool[];\n};\n\n/**\n * A component to display a list of tools for the user.\n *\n * @public\n */\nexport const Content = (props: ToolkitContentProps) => {\n const classes = useStyles();\n const toolkit = useToolkit();\n const tools = toolkit?.tools ?? props.tools;\n\n return (\n <List className={classes.toolkit}>\n {tools.map((tool: Tool) => (\n <Link key={tool.url} to={tool.url} className={classes.tool}>\n <ListItemIcon className={classes.icon}>{tool.icon}</ListItemIcon>\n <ListItemText\n secondaryTypographyProps={{ className: classes.label }}\n secondary={tool.label}\n />\n </Link>\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;AA4BA,MAAM,UAAU,cAA+C;MAElD,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,CAAC,YAAY,aAAa,MAAM,SAAS;AAE/C,QAAM,QAA6B;AAAA,IACjC,OAAO;AAAA;AAGT,6CAAQ,QAAQ,UAAT;AAAA,IAAkB;AAAA,KAAe;AAAA;MAG7B,aAAa,MAAM;AAC9B,QAAM,QAAQ,MAAM,WAAW;AAC/B,SAAO;AAAA;;ACtBT,MAAM,YAAY,WAAW;AAAU,EACrC,SAAS;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA;AAAA,EAEb,MAAM;AAAA,IACJ,QAAQ,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE7B,OAAO;AAAA,IACL,WAAW,MAAM,QAAQ;AAAA,IACzB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE5B,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW,MAAM,QAAQ;AAAA,IACzB,iBAAiB,MAAM,QAAQ,WAAW;AAAA;AAAA;MAkBjC,UAAU,CAAC,UAA+B;AAlEvD;AAmEE,QAAM,UAAU;AAChB,QAAM,UAAU;AAChB,QAAM,QAAQ,yCAAS,UAAT,YAAkB,MAAM;AAEtC,6CACG,MAAD;AAAA,IAAM,WAAW,QAAQ;AAAA,KACtB,MAAM,IAAI,CAAC,6CACT,MAAD;AAAA,IAAM,KAAK,KAAK;AAAA,IAAK,IAAI,KAAK;AAAA,IAAK,WAAW,QAAQ;AAAA,yCACnD,cAAD;AAAA,IAAc,WAAW,QAAQ;AAAA,KAAO,KAAK,2CAC5C,cAAD;AAAA,IACE,0BAA0B,EAAE,WAAW,QAAQ;AAAA,IAC/C,WAAW,KAAK;AAAA;AAAA;;;;"}
@@ -14,4 +14,4 @@ const HomepageCompositionRoot = (props) => {
14
14
  };
15
15
 
16
16
  export { HomepageCompositionRoot };
17
- //# sourceMappingURL=index-bce831c1.esm.js.map
17
+ //# sourceMappingURL=index-a82f6713.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-bce831c1.esm.js","sources":["../../src/components/HomepageCompositionRoot.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React, { ReactNode } from 'react';\nimport { useOutlet } from 'react-router';\n\nexport const HomepageCompositionRoot = (props: {\n title?: string;\n children?: ReactNode;\n}) => {\n const outlet = useOutlet();\n const children = props.children ?? outlet;\n return <>{children}</>;\n};\n"],"names":[],"mappings":";;;;;;;;MAmBa,0BAA0B,CAAC,UAGlC;AAtBN;AAuBE,QAAM,SAAS;AACf,QAAM,WAAW,YAAM,aAAN,YAAkB;AACnC,mEAAU;AAAA;;;;"}
1
+ {"version":3,"file":"index-a82f6713.esm.js","sources":["../../src/components/HomepageCompositionRoot.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React, { ReactNode } from 'react';\nimport { useOutlet } from 'react-router';\n\nexport const HomepageCompositionRoot = (props: {\n title?: string;\n children?: ReactNode;\n}) => {\n const outlet = useOutlet();\n const children = props.children ?? outlet;\n return <>{children}</>;\n};\n"],"names":[],"mappings":";;;;;;;;MAmBa,0BAA0B,CAAC,UAGlC;AAtBN;AAuBE,QAAM,SAAS;AACf,QAAM,WAAW,YAAM,aAAN,YAAkB;AACnC,mEAAU;AAAA;;;;"}
@@ -11,10 +11,14 @@ import '@backstage/core-plugin-api';
11
11
  const useStyles = makeStyles((theme) => ({
12
12
  settingsIconButton: {
13
13
  padding: theme.spacing(0, 1, 0, 0)
14
+ },
15
+ contentContainer: {
16
+ width: "100%"
14
17
  }
15
18
  }));
16
19
  const ComponentAccordion = ({
17
20
  title,
21
+ expanded = false,
18
22
  Content,
19
23
  Actions,
20
24
  Settings,
@@ -23,7 +27,7 @@ const ComponentAccordion = ({
23
27
  }) => {
24
28
  const classes = useStyles();
25
29
  const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false);
26
- const [isExpanded, setIsExpanded] = React.useState(false);
30
+ const [isExpanded, setIsExpanded] = React.useState(expanded);
27
31
  const handleOpenSettings = (e) => {
28
32
  e.stopPropagation();
29
33
  setSettingsIsExpanded((prevState) => !prevState);
@@ -34,13 +38,15 @@ const ComponentAccordion = ({
34
38
  componentName: title
35
39
  }, /* @__PURE__ */ React.createElement(Settings, null)), /* @__PURE__ */ React.createElement(Accordion, {
36
40
  expanded: isExpanded,
37
- onChange: (_e, expanded) => setIsExpanded(expanded)
41
+ onChange: (_e, expandedValue) => setIsExpanded(expandedValue)
38
42
  }, /* @__PURE__ */ React.createElement(AccordionSummary, {
39
43
  expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null)
40
44
  }, Settings && /* @__PURE__ */ React.createElement(IconButton, {
41
45
  onClick: handleOpenSettings,
42
46
  className: classes.settingsIconButton
43
- }, /* @__PURE__ */ React.createElement(SettingsIcon, null)), /* @__PURE__ */ React.createElement(Typography, null, title)), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Content, null), Actions && /* @__PURE__ */ React.createElement(Actions, null)))));
47
+ }, /* @__PURE__ */ React.createElement(SettingsIcon, null)), /* @__PURE__ */ React.createElement(Typography, null, title)), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement("div", {
48
+ className: classes.contentContainer
49
+ }, /* @__PURE__ */ React.createElement(Content, null), Actions && /* @__PURE__ */ React.createElement(Actions, null)))));
44
50
  return ContextProvider ? /* @__PURE__ */ React.createElement(ContextProvider, {
45
51
  ...childProps
46
52
  }, innerContent) : innerContent;
@@ -80,4 +86,4 @@ const ComponentTab = ({
80
86
  };
81
87
 
82
88
  export { ComponentAccordion, ComponentTab, ComponentTabs };
83
- //# sourceMappingURL=index-f319937c.esm.js.map
89
+ //# sourceMappingURL=index-ef0465b6.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-ef0465b6.esm.js","sources":["../../src/componentRenderers/ComponentAccordion.tsx","../../src/componentRenderers/ComponentTabs/ComponentTabs.tsx","../../src/componentRenderers/ComponentTabs/ComponentTab.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React from 'react';\nimport {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Typography,\n IconButton,\n Theme,\n} from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport { SettingsModal } from '../components';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n settingsIconButton: {\n padding: theme.spacing(0, 1, 0, 0),\n },\n contentContainer: {\n width: '100%',\n },\n}));\n\nexport const ComponentAccordion = ({\n title,\n expanded = false,\n Content,\n Actions,\n Settings,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n expanded?: boolean;\n Content: () => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n const classes = useStyles();\n const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false);\n const [isExpanded, setIsExpanded] = React.useState(expanded);\n\n const handleOpenSettings = (e: any) => {\n e.stopPropagation();\n setSettingsIsExpanded(prevState => !prevState);\n };\n\n const innerContent = (\n <>\n {Settings && (\n <SettingsModal\n open={settingsIsExpanded}\n close={() => setSettingsIsExpanded(false)}\n componentName={title}\n >\n <Settings />\n </SettingsModal>\n )}\n <Accordion\n expanded={isExpanded}\n onChange={(_e: any, expandedValue: boolean) =>\n setIsExpanded(expandedValue)\n }\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n {Settings && (\n <IconButton\n onClick={handleOpenSettings}\n className={classes.settingsIconButton}\n >\n <SettingsIcon />\n </IconButton>\n )}\n <Typography>{title}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <div className={classes.contentContainer}>\n <Content />\n {Actions && <Actions />}\n </div>\n </AccordionDetails>\n </Accordion>\n </>\n );\n\n return ContextProvider ? (\n <ContextProvider {...childProps}>{innerContent}</ContextProvider>\n ) : (\n innerContent\n );\n};\n","/*\n * Copyright 2021 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 React from 'react';\nimport { Tabs, Tab } from '@material-ui/core';\nimport { InfoCard } from '@backstage/core-components';\n\ntype TabType = {\n label: string;\n Component: () => JSX.Element;\n};\n\nexport const ComponentTabs = ({\n title,\n tabs,\n}: {\n title: string;\n tabs: TabType[];\n}) => {\n const [value, setValue] = React.useState(0);\n\n const handleChange = (_event: any, newValue: number) => {\n setValue(newValue);\n };\n\n return (\n <InfoCard title={title}>\n <Tabs value={value} onChange={handleChange}>\n {tabs.map(t => (\n <Tab key={t.label} label={t.label} />\n ))}\n </Tabs>\n {tabs.map(({ Component }, idx) => (\n <div\n key={idx}\n {...(idx !== value ? { style: { display: 'none' } } : {})}\n >\n <Component />\n </div>\n ))}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 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 React from 'react';\n\nexport const ComponentTab = ({\n title,\n Content,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n Content: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n return ContextProvider ? (\n <ContextProvider {...childProps}>\n <Content />\n </ContextProvider>\n ) : (\n <Content />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA+BA,MAAM,YAAY,WAAW,CAAC;AAAkB,EAC9C,oBAAoB;AAAA,IAClB,SAAS,MAAM,QAAQ,GAAG,GAAG,GAAG;AAAA;AAAA,EAElC,kBAAkB;AAAA,IAChB,OAAO;AAAA;AAAA;MAIE,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAQC;AACJ,QAAM,UAAU;AAChB,QAAM,CAAC,oBAAoB,yBAAyB,MAAM,SAAS;AACnE,QAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS;AAEnD,QAAM,qBAAqB,CAAC,MAAW;AACrC,MAAE;AACF,0BAAsB,eAAa,CAAC;AAAA;AAGtC,QAAM,yEAED,gDACE,eAAD;AAAA,IACE,MAAM;AAAA,IACN,OAAO,MAAM,sBAAsB;AAAA,IACnC,eAAe;AAAA,yCAEd,UAAD,4CAGH,WAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU,CAAC,IAAS,kBAClB,cAAc;AAAA,yCAGf,kBAAD;AAAA,IAAkB,gDAAa,gBAAD;AAAA,KAC3B,gDACE,YAAD;AAAA,IACE,SAAS;AAAA,IACT,WAAW,QAAQ;AAAA,yCAElB,cAAD,4CAGH,YAAD,MAAa,6CAEd,kBAAD,0CACG,OAAD;AAAA,IAAK,WAAW,QAAQ;AAAA,yCACrB,SAAD,OACC,+CAAY,SAAD;AAOtB,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,KAAa,gBAElC;AAAA;;MCjFS,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,CAAC,OAAO,YAAY,MAAM,SAAS;AAEzC,QAAM,eAAe,CAAC,QAAa,aAAqB;AACtD,aAAS;AAAA;AAGX,6CACG,UAAD;AAAA,IAAU;AAAA,yCACP,MAAD;AAAA,IAAM;AAAA,IAAc,UAAU;AAAA,KAC3B,KAAK,IAAI,2CACP,KAAD;AAAA,IAAK,KAAK,EAAE;AAAA,IAAO,OAAO,EAAE;AAAA,QAG/B,KAAK,IAAI,CAAC,EAAE,aAAa,4CACvB,OAAD;AAAA,IACE,KAAK;AAAA,OACA,QAAQ,QAAQ,EAAE,OAAO,EAAE,SAAS,aAAa;AAAA,yCAErD,WAAD;AAAA;;MChCG,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAKC;AACJ,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,yCAClB,SAAD,6CAGD,SAAD;AAAA;;;;"}
package/dist/index.d.ts CHANGED
@@ -34,6 +34,7 @@ declare type Tool = {
34
34
  url: string;
35
35
  icon: React__default.ReactNode;
36
36
  };
37
+
37
38
  /**
38
39
  * Props for Toolkit content component {@link Content}.
39
40
  *
@@ -50,8 +51,9 @@ declare const HomepageCompositionRoot: (props: {
50
51
  title?: string | undefined;
51
52
  children?: React.ReactNode;
52
53
  }) => JSX.Element;
53
- declare const ComponentAccordion: ({ title, Content, Actions, Settings, ContextProvider, ...childProps }: {
54
+ declare const ComponentAccordion: ({ title, expanded, Content, Actions, Settings, ContextProvider, ...childProps }: {
54
55
  title: string;
56
+ expanded?: boolean | undefined;
55
57
  Content: () => JSX.Element;
56
58
  Actions?: (() => JSX.Element) | undefined;
57
59
  Settings?: (() => JSX.Element) | undefined;
package/dist/index.esm.js CHANGED
@@ -146,25 +146,25 @@ const homePlugin = createPlugin({
146
146
  });
147
147
  const HomepageCompositionRoot = homePlugin.provide(createRoutableExtension({
148
148
  name: "HomepageCompositionRoot",
149
- component: () => import('./esm/index-bce831c1.esm.js').then((m) => m.HomepageCompositionRoot),
149
+ component: () => import('./esm/index-a82f6713.esm.js').then((m) => m.HomepageCompositionRoot),
150
150
  mountPoint: rootRouteRef
151
151
  }));
152
152
  const ComponentAccordion = homePlugin.provide(createComponentExtension({
153
153
  name: "ComponentAccordion",
154
154
  component: {
155
- lazy: () => import('./esm/index-f319937c.esm.js').then((m) => m.ComponentAccordion)
155
+ lazy: () => import('./esm/index-ef0465b6.esm.js').then((m) => m.ComponentAccordion)
156
156
  }
157
157
  }));
158
158
  const ComponentTabs = homePlugin.provide(createComponentExtension({
159
159
  name: "ComponentTabs",
160
160
  component: {
161
- lazy: () => import('./esm/index-f319937c.esm.js').then((m) => m.ComponentTabs)
161
+ lazy: () => import('./esm/index-ef0465b6.esm.js').then((m) => m.ComponentTabs)
162
162
  }
163
163
  }));
164
164
  const ComponentTab = homePlugin.provide(createComponentExtension({
165
165
  name: "ComponentTab",
166
166
  component: {
167
- lazy: () => import('./esm/index-f319937c.esm.js').then((m) => m.ComponentTab)
167
+ lazy: () => import('./esm/index-ef0465b6.esm.js').then((m) => m.ComponentTab)
168
168
  }
169
169
  }));
170
170
  const WelcomeTitle = homePlugin.provide(createComponentExtension({
@@ -187,7 +187,7 @@ const HomePageRandomJoke = homePlugin.provide(createCardExtension({
187
187
  const HomePageToolkit = homePlugin.provide(createCardExtension({
188
188
  name: "HomePageToolkit",
189
189
  title: "Toolkit",
190
- components: () => import('./esm/index-e6d55b70.esm.js')
190
+ components: () => import('./esm/index-75392e0a.esm.js')
191
191
  }));
192
192
  const HomePageStarredEntities = homePlugin.provide(createCardExtension({
193
193
  name: "HomePageStarredEntities",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-home",
3
3
  "description": "A Backstage plugin that helps you build a home page",
4
- "version": "0.4.14-next.0",
4
+ "version": "0.4.16",
5
5
  "main": "dist/index.esm.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -10,23 +10,36 @@
10
10
  "main": "dist/index.esm.js",
11
11
  "types": "dist/index.d.ts"
12
12
  },
13
+ "backstage": {
14
+ "role": "frontend-plugin"
15
+ },
16
+ "homepage": "https://github.com/backstage/backstage/tree/master/plugins/home#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/backstage/backstage",
20
+ "directory": "plugins/home"
21
+ },
22
+ "keywords": [
23
+ "backstage",
24
+ "homepage"
25
+ ],
13
26
  "scripts": {
14
- "build": "backstage-cli plugin:build",
15
- "start": "backstage-cli plugin:serve",
16
- "lint": "backstage-cli lint",
17
- "test": "backstage-cli test",
27
+ "build": "backstage-cli package build",
28
+ "start": "backstage-cli package start",
29
+ "lint": "backstage-cli package lint",
30
+ "test": "backstage-cli package test",
18
31
  "diff": "backstage-cli plugin:diff",
19
- "prepack": "backstage-cli prepack",
20
- "postpack": "backstage-cli postpack",
21
- "clean": "backstage-cli clean"
32
+ "prepack": "backstage-cli package prepack",
33
+ "postpack": "backstage-cli package postpack",
34
+ "clean": "backstage-cli package clean"
22
35
  },
23
36
  "dependencies": {
24
- "@backstage/catalog-model": "^0.9.10",
25
- "@backstage/core-components": "^0.8.8-next.0",
26
- "@backstage/core-plugin-api": "^0.6.0",
27
- "@backstage/plugin-catalog-react": "^0.6.14-next.0",
28
- "@backstage/plugin-search": "^0.6.2-next.0",
29
- "@backstage/theme": "^0.2.14",
37
+ "@backstage/catalog-model": "^0.11.0",
38
+ "@backstage/core-components": "^0.8.10",
39
+ "@backstage/core-plugin-api": "^0.7.0",
40
+ "@backstage/plugin-catalog-react": "^0.7.0",
41
+ "@backstage/plugin-search": "^0.7.1",
42
+ "@backstage/theme": "^0.2.15",
30
43
  "@material-ui/core": "^4.12.2",
31
44
  "@material-ui/icons": "^4.9.1",
32
45
  "@material-ui/lab": "4.0.0-alpha.57",
@@ -39,20 +52,20 @@
39
52
  "react": "^16.13.1 || ^17.0.0"
40
53
  },
41
54
  "devDependencies": {
42
- "@backstage/cli": "^0.13.2-next.0",
43
- "@backstage/core-app-api": "^0.5.2",
44
- "@backstage/dev-utils": "^0.2.21-next.0",
45
- "@backstage/test-utils": "^0.2.4",
55
+ "@backstage/cli": "^0.14.1",
56
+ "@backstage/core-app-api": "^0.5.4",
57
+ "@backstage/dev-utils": "^0.2.23",
58
+ "@backstage/test-utils": "^0.2.6",
46
59
  "@testing-library/jest-dom": "^5.10.1",
47
60
  "@testing-library/react": "^11.2.5",
48
61
  "@testing-library/user-event": "^13.1.8",
49
62
  "@types/jest": "^26.0.7",
50
63
  "@types/node": "^14.14.32",
51
- "cross-fetch": "^3.0.6",
64
+ "cross-fetch": "^3.1.5",
52
65
  "msw": "^0.35.0"
53
66
  },
54
67
  "files": [
55
68
  "dist"
56
69
  ],
57
- "gitHead": "e6f167225d843beeb974c287c3364d951b587626"
70
+ "gitHead": "a15da6ea1e3e8adc37be98be064071c8b5279b4a"
58
71
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-e6d55b70.esm.js","sources":["../../src/homePageComponents/Toolkit/Content.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { Link } from '@backstage/core-components';\nimport {\n makeStyles,\n List,\n ListItemIcon,\n ListItemText,\n} from '@material-ui/core';\nimport React from 'react';\n\nconst useStyles = makeStyles(theme => ({\n toolkit: {\n display: 'flex',\n flexWrap: 'wrap',\n textAlign: 'center',\n },\n tool: {\n margin: theme.spacing(0.5, 1),\n },\n label: {\n marginTop: theme.spacing(1),\n fontSize: '0.9em',\n lineHeight: '1.25',\n color: theme.palette.text.secondary,\n },\n icon: {\n width: '64px',\n height: '64px',\n borderRadius: '50px',\n justifyContent: 'center',\n alignItems: 'center',\n boxShadow: theme.shadows[1],\n backgroundColor: theme.palette.background.default,\n },\n}));\n\ntype Tool = {\n label: string;\n url: string;\n icon: React.ReactNode;\n};\n\n/**\n * Props for Toolkit content component {@link Content}.\n *\n * @public\n */\nexport type ToolkitContentProps = {\n tools: Tool[];\n};\n\n/**\n * A component to display a list of tools for the user.\n *\n * @public\n */\nexport const Content = (props: ToolkitContentProps) => {\n const classes = useStyles();\n\n return (\n <List className={classes.toolkit}>\n {props.tools.map((tool: Tool) => (\n <Link key={tool.url} to={tool.url} className={classes.tool}>\n <ListItemIcon className={classes.icon}>{tool.icon}</ListItemIcon>\n <ListItemText\n secondaryTypographyProps={{ className: classes.label }}\n secondary={tool.label}\n />\n </Link>\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;AAyBA,MAAM,YAAY,WAAW;AAAU,EACrC,SAAS;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA;AAAA,EAEb,MAAM;AAAA,IACJ,QAAQ,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE7B,OAAO;AAAA,IACL,WAAW,MAAM,QAAQ;AAAA,IACzB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,OAAO,MAAM,QAAQ,KAAK;AAAA;AAAA,EAE5B,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW,MAAM,QAAQ;AAAA,IACzB,iBAAiB,MAAM,QAAQ,WAAW;AAAA;AAAA;MAwBjC,UAAU,CAAC,UAA+B;AACrD,QAAM,UAAU;AAEhB,6CACG,MAAD;AAAA,IAAM,WAAW,QAAQ;AAAA,KACtB,MAAM,MAAM,IAAI,CAAC,6CACf,MAAD;AAAA,IAAM,KAAK,KAAK;AAAA,IAAK,IAAI,KAAK;AAAA,IAAK,WAAW,QAAQ;AAAA,yCACnD,cAAD;AAAA,IAAc,WAAW,QAAQ;AAAA,KAAO,KAAK,2CAC5C,cAAD;AAAA,IACE,0BAA0B,EAAE,WAAW,QAAQ;AAAA,IAC/C,WAAW,KAAK;AAAA;AAAA;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-f319937c.esm.js","sources":["../../src/componentRenderers/ComponentAccordion.tsx","../../src/componentRenderers/ComponentTabs/ComponentTabs.tsx","../../src/componentRenderers/ComponentTabs/ComponentTab.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 React from 'react';\nimport {\n Accordion,\n AccordionDetails,\n AccordionSummary,\n Typography,\n IconButton,\n Theme,\n} from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport SettingsIcon from '@material-ui/icons/Settings';\n\nimport { SettingsModal } from '../components';\n\nconst useStyles = makeStyles((theme: Theme) => ({\n settingsIconButton: {\n padding: theme.spacing(0, 1, 0, 0),\n },\n}));\n\nexport const ComponentAccordion = ({\n title,\n Content,\n Actions,\n Settings,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n Content: () => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n const classes = useStyles();\n const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false);\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n const handleOpenSettings = (e: any) => {\n e.stopPropagation();\n setSettingsIsExpanded(prevState => !prevState);\n };\n\n const innerContent = (\n <>\n {Settings && (\n <SettingsModal\n open={settingsIsExpanded}\n close={() => setSettingsIsExpanded(false)}\n componentName={title}\n >\n <Settings />\n </SettingsModal>\n )}\n <Accordion\n expanded={isExpanded}\n onChange={(_e: any, expanded: boolean) => setIsExpanded(expanded)}\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n {Settings && (\n <IconButton\n onClick={handleOpenSettings}\n className={classes.settingsIconButton}\n >\n <SettingsIcon />\n </IconButton>\n )}\n <Typography>{title}</Typography>\n </AccordionSummary>\n <AccordionDetails>\n <div>\n <Content />\n {Actions && <Actions />}\n </div>\n </AccordionDetails>\n </Accordion>\n </>\n );\n\n return ContextProvider ? (\n <ContextProvider {...childProps}>{innerContent}</ContextProvider>\n ) : (\n innerContent\n );\n};\n","/*\n * Copyright 2021 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 React from 'react';\nimport { Tabs, Tab } from '@material-ui/core';\nimport { InfoCard } from '@backstage/core-components';\n\ntype TabType = {\n label: string;\n Component: () => JSX.Element;\n};\n\nexport const ComponentTabs = ({\n title,\n tabs,\n}: {\n title: string;\n tabs: TabType[];\n}) => {\n const [value, setValue] = React.useState(0);\n\n const handleChange = (_event: any, newValue: number) => {\n setValue(newValue);\n };\n\n return (\n <InfoCard title={title}>\n <Tabs value={value} onChange={handleChange}>\n {tabs.map(t => (\n <Tab key={t.label} label={t.label} />\n ))}\n </Tabs>\n {tabs.map(({ Component }, idx) => (\n <div\n key={idx}\n {...(idx !== value ? { style: { display: 'none' } } : {})}\n >\n <Component />\n </div>\n ))}\n </InfoCard>\n );\n};\n","/*\n * Copyright 2021 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 React from 'react';\n\nexport const ComponentTab = ({\n title,\n Content,\n ContextProvider,\n ...childProps\n}: {\n title: string;\n Content: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n return ContextProvider ? (\n <ContextProvider {...childProps}>\n <Content />\n </ContextProvider>\n ) : (\n <Content />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA+BA,MAAM,YAAY,WAAW,CAAC;AAAkB,EAC9C,oBAAoB;AAAA,IAClB,SAAS,MAAM,QAAQ,GAAG,GAAG,GAAG;AAAA;AAAA;MAIvB,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAOC;AACJ,QAAM,UAAU;AAChB,QAAM,CAAC,oBAAoB,yBAAyB,MAAM,SAAS;AACnE,QAAM,CAAC,YAAY,iBAAiB,MAAM,SAAS;AAEnD,QAAM,qBAAqB,CAAC,MAAW;AACrC,MAAE;AACF,0BAAsB,eAAa,CAAC;AAAA;AAGtC,QAAM,yEAED,gDACE,eAAD;AAAA,IACE,MAAM;AAAA,IACN,OAAO,MAAM,sBAAsB;AAAA,IACnC,eAAe;AAAA,yCAEd,UAAD,4CAGH,WAAD;AAAA,IACE,UAAU;AAAA,IACV,UAAU,CAAC,IAAS,aAAsB,cAAc;AAAA,yCAEvD,kBAAD;AAAA,IAAkB,gDAAa,gBAAD;AAAA,KAC3B,gDACE,YAAD;AAAA,IACE,SAAS;AAAA,IACT,WAAW,QAAQ;AAAA,yCAElB,cAAD,4CAGH,YAAD,MAAa,6CAEd,kBAAD,0CACG,OAAD,0CACG,SAAD,OACC,+CAAY,SAAD;AAOtB,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,KAAa,gBAElC;AAAA;;MC1ES,gBAAgB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,MAII;AACJ,QAAM,CAAC,OAAO,YAAY,MAAM,SAAS;AAEzC,QAAM,eAAe,CAAC,QAAa,aAAqB;AACtD,aAAS;AAAA;AAGX,6CACG,UAAD;AAAA,IAAU;AAAA,yCACP,MAAD;AAAA,IAAM;AAAA,IAAc,UAAU;AAAA,KAC3B,KAAK,IAAI,2CACP,KAAD;AAAA,IAAK,KAAK,EAAE;AAAA,IAAO,OAAO,EAAE;AAAA,QAG/B,KAAK,IAAI,CAAC,EAAE,aAAa,4CACvB,OAAD;AAAA,IACE,KAAK;AAAA,OACA,QAAQ,QAAQ,EAAE,OAAO,EAAE,SAAS,aAAa;AAAA,yCAErD,WAAD;AAAA;;MChCG,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,MAKC;AACJ,SAAO,sDACJ,iBAAD;AAAA,OAAqB;AAAA,yCAClB,SAAD,6CAGD,SAAD;AAAA;;;;"}