@backstage/plugin-home 0.5.2 → 0.5.3-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 +29 -0
- package/README.md +29 -28
- package/dist/esm/{index-287238a7.esm.js → index-3155d776.esm.js} +2 -22
- package/dist/esm/index-3155d776.esm.js.map +1 -0
- package/dist/esm/{index-966fb783.esm.js → index-c05eb451.esm.js} +7 -5
- package/dist/esm/{index-966fb783.esm.js.map → index-c05eb451.esm.js.map} +1 -1
- package/dist/index.d.ts +123 -75
- package/dist/index.esm.js +161 -203
- package/dist/index.esm.js.map +1 -1
- package/package.json +11 -10
- package/dist/esm/index-287238a7.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @backstage/plugin-home
|
|
2
2
|
|
|
3
|
+
## 0.5.3-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d1cfb4e4c4cd: Update set up documentation to export homepage as element instead of React component.
|
|
8
|
+
- 2e4940e1a8f8: Allow more customization for the CustomHomepageGrid
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
- @backstage/core-components@0.13.2-next.1
|
|
11
|
+
- @backstage/plugin-catalog-react@1.7.0-next.1
|
|
12
|
+
- @backstage/catalog-model@1.4.0-next.0
|
|
13
|
+
- @backstage/core-plugin-api@1.5.2-next.0
|
|
14
|
+
- @backstage/plugin-home-react@0.1.0-next.1
|
|
15
|
+
- @backstage/config@1.0.7
|
|
16
|
+
- @backstage/theme@0.4.0-next.0
|
|
17
|
+
|
|
18
|
+
## 0.5.3-next.0
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 41e8037a8a6d: Extract new plugin-home-react package and deprecate createCardExtension in plugin-home
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @backstage/plugin-catalog-react@1.7.0-next.0
|
|
25
|
+
- @backstage/plugin-home-react@0.1.0-next.0
|
|
26
|
+
- @backstage/theme@0.4.0-next.0
|
|
27
|
+
- @backstage/config@1.0.7
|
|
28
|
+
- @backstage/core-components@0.13.2-next.0
|
|
29
|
+
- @backstage/core-plugin-api@1.5.1
|
|
30
|
+
- @backstage/catalog-model@1.3.0
|
|
31
|
+
|
|
3
32
|
## 0.5.2
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -22,11 +22,9 @@ yarn add --cwd packages/app @backstage/plugin-home
|
|
|
22
22
|
```tsx
|
|
23
23
|
import React from 'react';
|
|
24
24
|
|
|
25
|
-
export const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
};
|
|
25
|
+
export const homePage = (
|
|
26
|
+
/* TODO: Compose a Home Page here */
|
|
27
|
+
);
|
|
30
28
|
```
|
|
31
29
|
|
|
32
30
|
2. Add a route where the homepage will live, presumably `/`.
|
|
@@ -35,11 +33,11 @@ export const HomePage = () => {
|
|
|
35
33
|
|
|
36
34
|
```tsx
|
|
37
35
|
import { HomepageCompositionRoot } from '@backstage/plugin-home';
|
|
38
|
-
import {
|
|
36
|
+
import { homePage } from './components/home/HomePage';
|
|
39
37
|
|
|
40
38
|
// ...
|
|
41
39
|
<Route path="/" element={<HomepageCompositionRoot />}>
|
|
42
|
-
|
|
40
|
+
{homePage}
|
|
43
41
|
</Route>;
|
|
44
42
|
// ...
|
|
45
43
|
```
|
|
@@ -51,6 +49,8 @@ The Home Page can be composed with regular React components, so there's no magic
|
|
|
51
49
|
Finally, the `createCardExtension` also accepts a generic, such that Component Developers can indicate to App Integrators what custom props their component will accept, such as the example below where the default category of the random jokes can be set.
|
|
52
50
|
|
|
53
51
|
```tsx
|
|
52
|
+
import { createCardExtension } from '@backstage/plugin-home-react';
|
|
53
|
+
|
|
54
54
|
export const RandomJokeHomePageComponent = homePlugin.provide(
|
|
55
55
|
createCardExtension<{ defaultCategory?: 'programming' | 'any' }>({
|
|
56
56
|
title: 'Random Joke',
|
|
@@ -70,15 +70,13 @@ import React from 'react';
|
|
|
70
70
|
import Grid from '@material-ui/core/Grid';
|
|
71
71
|
import { RandomJokeHomePageComponent } from '@backstage/plugin-home';
|
|
72
72
|
|
|
73
|
-
export const
|
|
74
|
-
|
|
75
|
-
<Grid
|
|
76
|
-
<
|
|
77
|
-
<RandomJokeHomePageComponent />
|
|
78
|
-
</Grid>
|
|
73
|
+
export const homePage = (
|
|
74
|
+
<Grid container spacing={3}>
|
|
75
|
+
<Grid item xs={12} md={4}>
|
|
76
|
+
<RandomJokeHomePageComponent />
|
|
79
77
|
</Grid>
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
</Grid>
|
|
79
|
+
);
|
|
82
80
|
```
|
|
83
81
|
|
|
84
82
|
Additionally, the App Integrator is provided an escape hatch in case the way the card is rendered does not fit their requirements. They may optionally pass the `Renderer`-prop, which will receive the `title`, `content` and optionally `actions`, `settings` and `contextProvider`, if they exist for the component. This allows the App Integrator to render the content in any way they want.
|
|
@@ -100,18 +98,16 @@ import { HomePageSearchBar } from '@backstage/plugin-search';
|
|
|
100
98
|
import { HomePageCalendar } from '@backstage/plugin-gcalendar';
|
|
101
99
|
import { MicrosoftCalendarCard } from '@backstage/plugin-microsoft-calendar';
|
|
102
100
|
|
|
103
|
-
export const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
);
|
|
114
|
-
};
|
|
101
|
+
export const homePage = (
|
|
102
|
+
<CustomHomepageGrid>
|
|
103
|
+
// Insert the allowed widgets inside the grid
|
|
104
|
+
<HomePageSearchBar />
|
|
105
|
+
<HomePageRandomJoke />
|
|
106
|
+
<HomePageCalendar />
|
|
107
|
+
<MicrosoftCalendarCard />
|
|
108
|
+
<HomePageStarredEntities />
|
|
109
|
+
</CustomHomepageGrid>
|
|
110
|
+
);
|
|
115
111
|
```
|
|
116
112
|
|
|
117
113
|
### Creating Customizable Components
|
|
@@ -121,6 +117,8 @@ want to add additional configuration like component size or settings, you can de
|
|
|
121
117
|
property:
|
|
122
118
|
|
|
123
119
|
```tsx
|
|
120
|
+
import { createCardExtension } from '@backstage/plugin-home-react';
|
|
121
|
+
|
|
124
122
|
export const RandomJokeHomePageComponent = homePlugin.provide(
|
|
125
123
|
createCardExtension<{ defaultCategory?: 'any' | 'programming' }>({
|
|
126
124
|
name: 'HomePageRandomJoke',
|
|
@@ -178,6 +176,8 @@ properties. The `settings.schema` object should follow
|
|
|
178
176
|
must be `object`.
|
|
179
177
|
|
|
180
178
|
```tsx
|
|
179
|
+
import { createCardExtension } from '@backstage/plugin-home-react';
|
|
180
|
+
|
|
181
181
|
export const HomePageRandomJoke = homePlugin.provide(
|
|
182
182
|
createCardExtension<{ defaultCategory?: 'any' | 'programming' }>({
|
|
183
183
|
name: 'HomePageRandomJoke',
|
|
@@ -241,4 +241,5 @@ Additionally, the API is at a very early state, so contributing with additional
|
|
|
241
241
|
|
|
242
242
|
### Homepage Templates
|
|
243
243
|
|
|
244
|
-
We are hoping that we together can build up a collection of Homepage templates. We therefore put together a place where we can collect all the templates for the Home Plugin in the [storybook](https://backstage.io/storybook/?path=/story/plugins-home-templates).
|
|
244
|
+
We are hoping that we together can build up a collection of Homepage templates. We therefore put together a place where we can collect all the templates for the Home Plugin in the [storybook](https://backstage.io/storybook/?path=/story/plugins-home-templates).
|
|
245
|
+
If you would like to contribute with a template, start by taking a look at the [DefaultTemplate storybook example](/packages/app/src/components/home/templates/DefaultTemplate.stories.tsx) or [CustomizableTemplate storybook example](/packages/app/src/components/home/templates/CustomizableTemplate.stories.tsx) to create your own, and then open a PR with your suggestion.
|
|
@@ -1,30 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { SettingsModal } from '@backstage/plugin-home-react';
|
|
2
3
|
import { Accordion, AccordionSummary, IconButton, Typography, AccordionDetails, Tabs, Tab } from '@material-ui/core';
|
|
3
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
5
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
5
6
|
import SettingsIcon from '@material-ui/icons/Settings';
|
|
6
|
-
import 'react-router-dom';
|
|
7
|
-
import { SettingsModal } from '../index.esm.js';
|
|
8
7
|
import { InfoCard } from '@backstage/core-components';
|
|
9
|
-
import '@backstage/core-plugin-api';
|
|
10
|
-
import 'react-grid-layout';
|
|
11
|
-
import 'react-grid-layout/css/styles.css';
|
|
12
|
-
import 'react-resizable/css/styles.css';
|
|
13
|
-
import 'lodash';
|
|
14
|
-
import 'react-use/lib/useObservable';
|
|
15
|
-
import '@material-ui/core/Typography';
|
|
16
|
-
import '@material-ui/core/IconButton';
|
|
17
|
-
import '@material-ui/icons/Delete';
|
|
18
|
-
import '@rjsf/core-v5';
|
|
19
|
-
import '@rjsf/validator-ajv8';
|
|
20
|
-
import '@material-ui/core/List';
|
|
21
|
-
import '@material-ui/core/ListItem';
|
|
22
|
-
import '@material-ui/icons/Add';
|
|
23
|
-
import '@material-ui/core/ListItemText';
|
|
24
|
-
import '@material-ui/core/Button';
|
|
25
|
-
import '@material-ui/icons/Save';
|
|
26
|
-
import '@material-ui/icons/Edit';
|
|
27
|
-
import 'zod';
|
|
28
8
|
|
|
29
9
|
const useStyles = makeStyles((theme) => ({
|
|
30
10
|
settingsIconButton: {
|
|
@@ -100,4 +80,4 @@ const ComponentTab = (props) => {
|
|
|
100
80
|
};
|
|
101
81
|
|
|
102
82
|
export { ComponentAccordion, ComponentTab, ComponentTabs };
|
|
103
|
-
//# sourceMappingURL=index-
|
|
83
|
+
//# sourceMappingURL=index-3155d776.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-3155d776.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 { SettingsModal } from '@backstage/plugin-home-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\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 = (props: {\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 {\n title,\n expanded = false,\n Content,\n Actions,\n Settings,\n ContextProvider,\n ...childProps\n } = props;\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 = (props: { title: string; tabs: TabType[] }) => {\n const { title, tabs } = props;\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 = (props: {\n title: string;\n Content: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n}) => {\n const { title, Content, ContextProvider, ...childProps } = props;\n\n return ContextProvider ? (\n <ContextProvider {...childProps}>\n <Content />\n </ContextProvider>\n ) : (\n <Content />\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA8BA,MAAM,SAAA,GAAY,UAAW,CAAA,CAAC,KAAkB,MAAA;AAAA,EAC9C,kBAAoB,EAAA;AAAA,IAClB,SAAS,KAAM,CAAA,OAAA,CAAQ,CAAG,EAAA,CAAA,EAAG,GAAG,CAAC,CAAA;AAAA,GACnC;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,kBAAA,GAAqB,CAAC,KAO7B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,OAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA,GAAG,UAAA;AAAA,GACD,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,CAAC,kBAAoB,EAAA,qBAAqB,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AACxE,EAAA,MAAM,CAAC,UAAY,EAAA,aAAa,CAAI,GAAA,KAAA,CAAM,SAAS,QAAQ,CAAA,CAAA;AAE3D,EAAM,MAAA,kBAAA,GAAqB,CAAC,CAAW,KAAA;AACrC,IAAA,CAAA,CAAE,eAAgB,EAAA,CAAA;AAClB,IAAsB,qBAAA,CAAA,CAAA,SAAA,KAAa,CAAC,SAAS,CAAA,CAAA;AAAA,GAC/C,CAAA;AAEA,EAAM,MAAA,YAAA,6DAED,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ACX,CAEA,mBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,IAAA,CAAA,CAAA;AAEb;;;;"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useOutlet } from 'react-router-dom';
|
|
3
|
-
export { CustomHomepageGrid
|
|
3
|
+
export { CustomHomepageGrid } from '../index.esm.js';
|
|
4
4
|
import '@backstage/core-plugin-api';
|
|
5
|
-
import '@
|
|
6
|
-
import '@material-ui/icons/Settings';
|
|
7
|
-
import '@backstage/core-components';
|
|
5
|
+
import '@backstage/plugin-home-react';
|
|
8
6
|
import 'react-grid-layout';
|
|
9
7
|
import 'react-grid-layout/css/styles.css';
|
|
10
8
|
import 'react-resizable/css/styles.css';
|
|
9
|
+
import '@material-ui/core';
|
|
11
10
|
import 'lodash';
|
|
12
11
|
import 'react-use/lib/useObservable';
|
|
12
|
+
import '@backstage/core-components';
|
|
13
13
|
import '@material-ui/core/Typography';
|
|
14
14
|
import '@material-ui/core/IconButton';
|
|
15
|
+
import '@material-ui/icons/Settings';
|
|
15
16
|
import '@material-ui/icons/Delete';
|
|
16
17
|
import '@rjsf/core-v5';
|
|
17
18
|
import '@rjsf/validator-ajv8';
|
|
@@ -22,6 +23,7 @@ import '@material-ui/core/ListItemText';
|
|
|
22
23
|
import '@material-ui/core/Button';
|
|
23
24
|
import '@material-ui/icons/Save';
|
|
24
25
|
import '@material-ui/icons/Edit';
|
|
26
|
+
import '@material-ui/icons/Cancel';
|
|
25
27
|
import 'zod';
|
|
26
28
|
|
|
27
29
|
const HomepageCompositionRoot = (props) => {
|
|
@@ -32,4 +34,4 @@ const HomepageCompositionRoot = (props) => {
|
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export { HomepageCompositionRoot };
|
|
35
|
-
//# sourceMappingURL=index-
|
|
37
|
+
//# sourceMappingURL=index-c05eb451.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-c05eb451.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-dom';\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBa,MAAA,uBAAA,GAA0B,CAAC,KAGlC,KAAA;AAtBN,EAAA,IAAA,EAAA,CAAA;AAuBE,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAM,MAAA,QAAA,GAAA,CAAW,EAAM,GAAA,KAAA,CAAA,QAAA,KAAN,IAAkB,GAAA,EAAA,GAAA,MAAA,CAAA;AACnC,EAAA,iEAAU,QAAS,CAAA,CAAA;AACrB;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import react__default, { ReactElement, ReactNode } from 'react';
|
|
4
|
+
import * as _backstage_plugin_home_react from '@backstage/plugin-home-react';
|
|
5
|
+
import { createCardExtension as createCardExtension$1, CardExtensionProps as CardExtensionProps$1, CardLayout as CardLayout$1, CardSettings as CardSettings$1, CardConfig as CardConfig$1, ComponentParts as ComponentParts$1, ComponentRenderer as ComponentRenderer$1, RendererProps as RendererProps$1 } from '@backstage/plugin-home-react';
|
|
4
6
|
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
5
|
-
import { RJSFSchema } from '@rjsf/utils';
|
|
6
7
|
|
|
7
8
|
/** @public */
|
|
8
9
|
type Tool = {
|
|
@@ -26,68 +27,6 @@ type ClockConfig = {
|
|
|
26
27
|
timeZone: string;
|
|
27
28
|
};
|
|
28
29
|
|
|
29
|
-
/**
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
type ComponentRenderer = {
|
|
33
|
-
Renderer?: (props: RendererProps) => JSX.Element;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
type ComponentParts = {
|
|
39
|
-
Content: (props?: any) => JSX.Element;
|
|
40
|
-
Actions?: () => JSX.Element;
|
|
41
|
-
Settings?: () => JSX.Element;
|
|
42
|
-
ContextProvider?: (props: any) => JSX.Element;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
type RendererProps = {
|
|
48
|
-
title: string;
|
|
49
|
-
} & ComponentParts;
|
|
50
|
-
/**
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
type CardExtensionProps<T> = ComponentRenderer & {
|
|
54
|
-
title?: string;
|
|
55
|
-
} & T;
|
|
56
|
-
/**
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
type CardLayout = {
|
|
60
|
-
width?: {
|
|
61
|
-
minColumns?: number;
|
|
62
|
-
maxColumns?: number;
|
|
63
|
-
defaultColumns?: number;
|
|
64
|
-
};
|
|
65
|
-
height?: {
|
|
66
|
-
minRows?: number;
|
|
67
|
-
maxRows?: number;
|
|
68
|
-
defaultRows?: number;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* @public
|
|
73
|
-
*/
|
|
74
|
-
type CardSettings = {
|
|
75
|
-
schema?: RJSFSchema;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* An extension creator to create card based components for the homepage
|
|
79
|
-
*
|
|
80
|
-
* @public
|
|
81
|
-
*/
|
|
82
|
-
declare function createCardExtension<T>(options: {
|
|
83
|
-
title: string;
|
|
84
|
-
components: () => Promise<ComponentParts>;
|
|
85
|
-
name?: string;
|
|
86
|
-
description?: string;
|
|
87
|
-
layout?: CardLayout;
|
|
88
|
-
settings?: CardSettings;
|
|
89
|
-
}): _backstage_core_plugin_api.Extension<(props: CardExtensionProps<T>) => JSX.Element>;
|
|
90
|
-
|
|
91
30
|
/** @public */
|
|
92
31
|
declare const homePlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
93
32
|
root: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
@@ -136,7 +75,7 @@ declare const HomePageCompanyLogo: (props: {
|
|
|
136
75
|
className?: string | undefined;
|
|
137
76
|
}) => JSX.Element;
|
|
138
77
|
/** @public */
|
|
139
|
-
declare const HomePageRandomJoke: (props: CardExtensionProps<{
|
|
78
|
+
declare const HomePageRandomJoke: (props: _backstage_plugin_home_react.CardExtensionProps<{
|
|
140
79
|
defaultCategory?: "any" | "programming" | undefined;
|
|
141
80
|
}>) => JSX.Element;
|
|
142
81
|
/**
|
|
@@ -144,13 +83,13 @@ declare const HomePageRandomJoke: (props: CardExtensionProps<{
|
|
|
144
83
|
*
|
|
145
84
|
* @public
|
|
146
85
|
*/
|
|
147
|
-
declare const HomePageToolkit: (props: CardExtensionProps<ToolkitContentProps>) => JSX.Element;
|
|
86
|
+
declare const HomePageToolkit: (props: _backstage_plugin_home_react.CardExtensionProps<ToolkitContentProps>) => JSX.Element;
|
|
148
87
|
/**
|
|
149
88
|
* A component to display a list of starred entities for the user.
|
|
150
89
|
*
|
|
151
90
|
* @public
|
|
152
91
|
*/
|
|
153
|
-
declare const HomePageStarredEntities: (props: CardExtensionProps<unknown>) => JSX.Element;
|
|
92
|
+
declare const HomePageStarredEntities: (props: _backstage_plugin_home_react.CardExtensionProps<unknown>) => JSX.Element;
|
|
154
93
|
/**
|
|
155
94
|
* A component to display a configurable list of clocks for various time zones.
|
|
156
95
|
*
|
|
@@ -161,14 +100,6 @@ declare const HeaderWorldClock: (props: {
|
|
|
161
100
|
customTimeFormat?: Intl.DateTimeFormatOptions | undefined;
|
|
162
101
|
}) => JSX.Element | null;
|
|
163
102
|
|
|
164
|
-
/** @public */
|
|
165
|
-
declare const SettingsModal: (props: {
|
|
166
|
-
open: boolean;
|
|
167
|
-
close: Function;
|
|
168
|
-
componentName: string;
|
|
169
|
-
children: JSX.Element;
|
|
170
|
-
}) => JSX.Element;
|
|
171
|
-
|
|
172
103
|
/**
|
|
173
104
|
* Layout configuration that can be passed to the custom home page.
|
|
174
105
|
*
|
|
@@ -183,12 +114,78 @@ type LayoutConfiguration = {
|
|
|
183
114
|
};
|
|
184
115
|
|
|
185
116
|
/**
|
|
117
|
+
* Breakpoint options for <CustomHomepageGridProps/>
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
122
|
+
/**
|
|
123
|
+
* Props customizing the <CustomHomepageGrid/> component.
|
|
124
|
+
*
|
|
186
125
|
* @public
|
|
187
126
|
*/
|
|
188
127
|
type CustomHomepageGridProps = {
|
|
128
|
+
/**
|
|
129
|
+
* Children contain all widgets user can configure on their own homepage.
|
|
130
|
+
*/
|
|
189
131
|
children?: ReactNode;
|
|
132
|
+
/**
|
|
133
|
+
* Default layout for the homepage before users have modified it.
|
|
134
|
+
*/
|
|
190
135
|
config?: LayoutConfiguration[];
|
|
136
|
+
/**
|
|
137
|
+
* Height of grid row in pixels.
|
|
138
|
+
* @defaultValue 60
|
|
139
|
+
*/
|
|
191
140
|
rowHeight?: number;
|
|
141
|
+
/**
|
|
142
|
+
* Screen width in pixels for different breakpoints.
|
|
143
|
+
* @defaultValue theme breakpoints
|
|
144
|
+
*/
|
|
145
|
+
breakpoints?: Record<Breakpoint, number>;
|
|
146
|
+
/**
|
|
147
|
+
* Number of grid columns for different breakpoints.
|
|
148
|
+
* @defaultValue \{ lg: 12, md: 10, sm: 6, xs: 4, xxs: 2 \}
|
|
149
|
+
*/
|
|
150
|
+
cols?: Record<Breakpoint, number>;
|
|
151
|
+
/**
|
|
152
|
+
* Grid container padding (x, y) in pixels for all or specific breakpoints.
|
|
153
|
+
* @defaultValue [0, 0]
|
|
154
|
+
* @example [10, 10]
|
|
155
|
+
* @example \{ lg: [10, 10] \}
|
|
156
|
+
*/
|
|
157
|
+
containerPadding?: [number, number] | Record<Breakpoint, [number, number]>;
|
|
158
|
+
/**
|
|
159
|
+
* Grid container margin (x, y) in pixels for all or specific breakpoints.
|
|
160
|
+
* @defaultValue [0, 0]
|
|
161
|
+
* @example [10, 10]
|
|
162
|
+
* @example \{ lg: [10, 10] \}
|
|
163
|
+
*/
|
|
164
|
+
containerMargin?: [number, number] | Record<Breakpoint, [number, number]>;
|
|
165
|
+
/**
|
|
166
|
+
* Maximum number of rows user can have in the grid.
|
|
167
|
+
* @defaultValue unlimited
|
|
168
|
+
*/
|
|
169
|
+
maxRows?: number;
|
|
170
|
+
/**
|
|
171
|
+
* Custom style for grid.
|
|
172
|
+
*/
|
|
173
|
+
style?: react__default.CSSProperties;
|
|
174
|
+
/**
|
|
175
|
+
* Compaction type of widgets in the grid. This controls where widgets are moved in case
|
|
176
|
+
* they are overlapping in the grid.
|
|
177
|
+
*/
|
|
178
|
+
compactType?: 'vertical' | 'horizontal' | null;
|
|
179
|
+
/**
|
|
180
|
+
* Controls if widgets can overlap in the grid. If true, grid can be placed one over the other.
|
|
181
|
+
* @defaultValue false
|
|
182
|
+
*/
|
|
183
|
+
allowOverlap?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Controls if widgets can collide with each other. If true, grid items won't change position when being dragged over.
|
|
186
|
+
* @defaultValue false
|
|
187
|
+
*/
|
|
188
|
+
preventCollision?: boolean;
|
|
192
189
|
};
|
|
193
190
|
/**
|
|
194
191
|
* A component that allows customizing components in home grid layout.
|
|
@@ -208,4 +205,55 @@ declare const TemplateBackstageLogo: (props: {
|
|
|
208
205
|
/** @public */
|
|
209
206
|
declare const TemplateBackstageLogoIcon: () => JSX.Element;
|
|
210
207
|
|
|
211
|
-
|
|
208
|
+
/**
|
|
209
|
+
* @public
|
|
210
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
211
|
+
*/
|
|
212
|
+
declare const createCardExtension: typeof createCardExtension$1;
|
|
213
|
+
/**
|
|
214
|
+
* @public
|
|
215
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
216
|
+
*/
|
|
217
|
+
type CardExtensionProps<T> = CardExtensionProps$1<T>;
|
|
218
|
+
/**
|
|
219
|
+
* @public
|
|
220
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
221
|
+
*/
|
|
222
|
+
type CardLayout = CardLayout$1;
|
|
223
|
+
/**
|
|
224
|
+
* @public
|
|
225
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
226
|
+
*/
|
|
227
|
+
type CardSettings = CardSettings$1;
|
|
228
|
+
/**
|
|
229
|
+
* @public
|
|
230
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
231
|
+
*/
|
|
232
|
+
type CardConfig = CardConfig$1;
|
|
233
|
+
/**
|
|
234
|
+
* @public
|
|
235
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
236
|
+
*/
|
|
237
|
+
type ComponentParts = ComponentParts$1;
|
|
238
|
+
/**
|
|
239
|
+
* @public
|
|
240
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
241
|
+
*/
|
|
242
|
+
type ComponentRenderer = ComponentRenderer$1;
|
|
243
|
+
/**
|
|
244
|
+
* @public
|
|
245
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
246
|
+
*/
|
|
247
|
+
type RendererProps = RendererProps$1;
|
|
248
|
+
/**
|
|
249
|
+
* @public
|
|
250
|
+
* @deprecated Import from `@backstage/plugin-home-react` instead
|
|
251
|
+
*/
|
|
252
|
+
declare const SettingsModal: (props: {
|
|
253
|
+
open: boolean;
|
|
254
|
+
close: Function;
|
|
255
|
+
componentName: string;
|
|
256
|
+
children: JSX.Element;
|
|
257
|
+
}) => JSX.Element;
|
|
258
|
+
|
|
259
|
+
export { Breakpoint, CardConfig, CardExtensionProps, CardLayout, CardSettings, ClockConfig, ComponentAccordion, ComponentParts, ComponentRenderer, ComponentTab, ComponentTabs, CustomHomepageGrid, CustomHomepageGridProps, HeaderWorldClock, HomePageCompanyLogo, HomePageRandomJoke, HomePageStarredEntities, HomePageToolkit, HomepageCompositionRoot, LayoutConfiguration, RendererProps, SettingsModal, TemplateBackstageLogo, TemplateBackstageLogoIcon, Tool, ToolkitContentProps, WelcomeTitle, createCardExtension, homePlugin };
|