@backstage/plugin-home-react 0.1.25-next.0 → 0.1.25-next.2

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,25 @@
1
1
  # @backstage/plugin-home-react
2
2
 
3
+ ## 0.1.25-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
8
+
9
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
10
+
11
+ - Updated dependencies
12
+ - @backstage/core-components@0.17.1-next.1
13
+ - @backstage/core-plugin-api@1.10.6-next.0
14
+
15
+ ## 0.1.25-next.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+ - @backstage/core-components@0.17.1-next.0
21
+ - @backstage/core-plugin-api@1.10.5
22
+
3
23
  ## 0.1.25-next.0
4
24
 
5
25
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import Button from '@material-ui/core/Button';
3
3
  import Dialog from '@material-ui/core/Dialog';
4
4
  import DialogActions from '@material-ui/core/DialogActions';
@@ -7,7 +7,11 @@ import DialogTitle from '@material-ui/core/DialogTitle';
7
7
 
8
8
  const SettingsModal = (props) => {
9
9
  const { open, close, componentName, children } = props;
10
- return /* @__PURE__ */ React.createElement(Dialog, { open, onClose: () => close() }, /* @__PURE__ */ React.createElement(DialogTitle, null, componentName ? `Settings - ${componentName}` : "Settings"), /* @__PURE__ */ React.createElement(DialogContent, null, children), /* @__PURE__ */ React.createElement(DialogActions, null, /* @__PURE__ */ React.createElement(Button, { onClick: () => close(), color: "primary", variant: "contained" }, "Close")));
10
+ return /* @__PURE__ */ jsxs(Dialog, { open, onClose: () => close(), children: [
11
+ /* @__PURE__ */ jsx(DialogTitle, { children: componentName ? `Settings - ${componentName}` : "Settings" }),
12
+ /* @__PURE__ */ jsx(DialogContent, { children }),
13
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { onClick: () => close(), color: "primary", variant: "contained", children: "Close" }) })
14
+ ] });
11
15
  };
12
16
 
13
17
  export { SettingsModal };
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsModal.esm.js","sources":["../../src/components/SettingsModal.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 Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\n\n/** @public */\nexport const SettingsModal = (props: {\n open: boolean;\n close: Function;\n componentName?: string;\n children: JSX.Element;\n}) => {\n const { open, close, componentName, children } = props;\n\n return (\n <Dialog open={open} onClose={() => close()}>\n <DialogTitle>\n {componentName ? `Settings - ${componentName}` : 'Settings'}\n </DialogTitle>\n <DialogContent>{children}</DialogContent>\n <DialogActions>\n <Button onClick={() => close()} color=\"primary\" variant=\"contained\">\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAwBa,MAAA,aAAA,GAAgB,CAAC,KAKxB,KAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,aAAA,EAAe,UAAa,GAAA,KAAA;AAEjD,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,IAAY,EAAA,OAAA,EAAS,MAAM,KAAM,EAAA,EAAA,kBACtC,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,IAAA,EACE,aAAgB,GAAA,CAAA,WAAA,EAAc,aAAa,CAAA,CAAA,GAAK,UACnD,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAe,EAAA,IAAA,EAAA,QAAS,CACzB,kBAAA,KAAA,CAAA,aAAA,CAAC,aACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAO,OAAS,EAAA,MAAM,KAAM,EAAA,EAAG,OAAM,SAAU,EAAA,OAAA,EAAQ,WAAY,EAAA,EAAA,OAEpE,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SettingsModal.esm.js","sources":["../../src/components/SettingsModal.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 Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\n\n/** @public */\nexport const SettingsModal = (props: {\n open: boolean;\n close: Function;\n componentName?: string;\n children: JSX.Element;\n}) => {\n const { open, close, componentName, children } = props;\n\n return (\n <Dialog open={open} onClose={() => close()}>\n <DialogTitle>\n {componentName ? `Settings - ${componentName}` : 'Settings'}\n </DialogTitle>\n <DialogContent>{children}</DialogContent>\n <DialogActions>\n <Button onClick={() => close()} color=\"primary\" variant=\"contained\">\n Close\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,aAAA,GAAgB,CAAC,KAKxB,KAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,aAAA,EAAe,UAAa,GAAA,KAAA;AAEjD,EAAA,4BACG,MAAO,EAAA,EAAA,IAAA,EAAY,OAAS,EAAA,MAAM,OACjC,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,WACE,EAAA,EAAA,QAAA,EAAA,aAAA,GAAgB,CAAc,WAAA,EAAA,aAAa,KAAK,UACnD,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,iBAAe,QAAS,EAAA,CAAA;AAAA,oBACxB,GAAA,CAAA,aAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAO,OAAS,EAAA,MAAM,KAAM,EAAA,EAAG,KAAM,EAAA,SAAA,EAAU,OAAQ,EAAA,WAAA,EAAY,mBAEpE,CACF,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { Suspense } from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useState, Suspense } from 'react';
2
3
  import IconButton from '@material-ui/core/IconButton';
3
4
  import SettingsIcon from '@material-ui/icons/Settings';
4
5
  import { InfoCard } from '@backstage/core-components';
@@ -14,7 +15,7 @@ function createCardExtension(options) {
14
15
  component: {
15
16
  lazy: () => components().then((componentParts) => {
16
17
  return (props) => {
17
- return /* @__PURE__ */ React.createElement(
18
+ return /* @__PURE__ */ jsx(
18
19
  CardExtension,
19
20
  {
20
21
  ...props,
@@ -41,9 +42,9 @@ function CardExtension(props) {
41
42
  } = props;
42
43
  const app = useApp();
43
44
  const { Progress } = app.getComponents();
44
- const [settingsOpen, setSettingsOpen] = React.useState(false);
45
+ const [settingsOpen, setSettingsOpen] = useState(false);
45
46
  if (Renderer) {
46
- return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, /* @__PURE__ */ React.createElement(
47
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Progress, {}), children: /* @__PURE__ */ jsx(
47
48
  Renderer,
48
49
  {
49
50
  ...title && { title },
@@ -55,28 +56,31 @@ function CardExtension(props) {
55
56
  ...childProps
56
57
  }
57
58
  }
58
- ));
59
+ ) });
59
60
  }
60
61
  const cardProps = {
61
62
  divider: !!title,
62
63
  ...title && { title },
63
64
  ...Settings && !isCustomizable ? {
64
- action: /* @__PURE__ */ React.createElement(IconButton, { onClick: () => setSettingsOpen(true) }, /* @__PURE__ */ React.createElement(SettingsIcon, null, "Settings"))
65
+ action: /* @__PURE__ */ jsx(IconButton, { onClick: () => setSettingsOpen(true), children: /* @__PURE__ */ jsx(SettingsIcon, { children: "Settings" }) })
65
66
  } : {},
66
67
  ...Actions ? {
67
- actions: /* @__PURE__ */ React.createElement(Actions, null)
68
+ actions: /* @__PURE__ */ jsx(Actions, {})
68
69
  } : {}
69
70
  };
70
- const innerContent = /* @__PURE__ */ React.createElement(InfoCard, { ...cardProps }, Settings && !isCustomizable && /* @__PURE__ */ React.createElement(
71
- SettingsModal,
72
- {
73
- open: settingsOpen,
74
- componentName: title,
75
- close: () => setSettingsOpen(false)
76
- },
77
- /* @__PURE__ */ React.createElement(Settings, null)
78
- ), /* @__PURE__ */ React.createElement(Content, { ...childProps }));
79
- return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Progress, null) }, ContextProvider ? /* @__PURE__ */ React.createElement(ContextProvider, { ...childProps }, innerContent) : innerContent);
71
+ const innerContent = /* @__PURE__ */ jsxs(InfoCard, { ...cardProps, children: [
72
+ Settings && !isCustomizable && /* @__PURE__ */ jsx(
73
+ SettingsModal,
74
+ {
75
+ open: settingsOpen,
76
+ componentName: title,
77
+ close: () => setSettingsOpen(false),
78
+ children: /* @__PURE__ */ jsx(Settings, {})
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(Content, { ...childProps })
82
+ ] });
83
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Progress, {}), children: ContextProvider ? /* @__PURE__ */ jsx(ContextProvider, { ...childProps, children: innerContent }) : innerContent });
80
84
  }
81
85
 
82
86
  export { createCardExtension };
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.esm.js","sources":["../src/extensions.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, { Suspense } from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { InfoCard } from '@backstage/core-components';\nimport { SettingsModal } from './components';\nimport { createReactExtension, useApp } from '@backstage/core-plugin-api';\nimport { RJSFSchema, UiSchema } from '@rjsf/utils';\n\n/**\n * @public\n */\nexport type ComponentRenderer = {\n Renderer?: (props: RendererProps) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type ComponentParts = {\n Content: (props?: any) => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type RendererProps = { title?: string } & ComponentParts;\n\n/**\n * @public\n */\nexport type CardExtensionProps<T> = ComponentRenderer & {\n title?: string;\n} & T;\n\n/**\n * @public\n */\nexport type CardLayout = {\n width?: { minColumns?: number; maxColumns?: number; defaultColumns?: number };\n height?: { minRows?: number; maxRows?: number; defaultRows?: number };\n};\n\n/**\n * @public\n */\nexport type CardSettings = {\n schema?: RJSFSchema;\n uiSchema?: UiSchema;\n};\n\n/**\n * @public\n */\nexport type CardConfig = {\n layout?: CardLayout;\n settings?: CardSettings;\n};\n\n/**\n * An extension creator to create card based components for the homepage\n *\n * @public\n */\nexport function createCardExtension<T>(options: {\n title?: string;\n components: () => Promise<ComponentParts>;\n name?: string;\n description?: string;\n layout?: CardLayout;\n settings?: CardSettings;\n}) {\n const { title, components, name, description, layout, settings } = options;\n // If widget settings schema is defined, we don't want to show the Settings icon or dialog\n const isCustomizable = settings?.schema !== undefined;\n\n return createReactExtension({\n name,\n data: { title, description, 'home.widget.config': { layout, settings } },\n component: {\n lazy: () =>\n components().then(componentParts => {\n return (props: CardExtensionProps<T>) => {\n return (\n <CardExtension\n {...props}\n {...componentParts}\n title={props.title || title}\n isCustomizable={isCustomizable}\n />\n );\n };\n }),\n },\n });\n}\n\ntype CardExtensionComponentProps<T> = CardExtensionProps<T> &\n ComponentParts & {\n isCustomizable?: boolean;\n overrideTitle?: string;\n };\n\nfunction CardExtension<T>(props: CardExtensionComponentProps<T>) {\n const {\n Renderer,\n Content,\n Settings,\n Actions,\n ContextProvider,\n isCustomizable,\n title,\n ...childProps\n } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n const [settingsOpen, setSettingsOpen] = React.useState(false);\n\n if (Renderer) {\n return (\n <Suspense fallback={<Progress />}>\n <Renderer\n {...(title && { title })}\n {...{\n Content,\n ...(Actions ? { Actions } : {}),\n ...(Settings && !isCustomizable ? { Settings } : {}),\n ...(ContextProvider ? { ContextProvider } : {}),\n ...childProps,\n }}\n />\n </Suspense>\n );\n }\n\n const cardProps = {\n divider: !!title,\n ...(title && { title }),\n ...(Settings && !isCustomizable\n ? {\n action: (\n <IconButton onClick={() => setSettingsOpen(true)}>\n <SettingsIcon>Settings</SettingsIcon>\n </IconButton>\n ),\n }\n : {}),\n ...(Actions\n ? {\n actions: <Actions />,\n }\n : {}),\n };\n\n const innerContent = (\n <InfoCard {...cardProps}>\n {Settings && !isCustomizable && (\n <SettingsModal\n open={settingsOpen}\n componentName={title}\n close={() => setSettingsOpen(false)}\n >\n <Settings />\n </SettingsModal>\n )}\n <Content {...childProps} />\n </InfoCard>\n );\n\n return (\n <Suspense fallback={<Progress />}>\n {ContextProvider ? (\n <ContextProvider {...childProps}>{innerContent}</ContextProvider>\n ) : (\n innerContent\n )}\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAkFO,SAAS,oBAAuB,OAOpC,EAAA;AACD,EAAA,MAAM,EAAE,KAAO,EAAA,UAAA,EAAY,MAAM,WAAa,EAAA,MAAA,EAAQ,UAAa,GAAA,OAAA;AAEnE,EAAM,MAAA,cAAA,GAAiB,UAAU,MAAW,KAAA,KAAA,CAAA;AAE5C,EAAA,OAAO,oBAAqB,CAAA;AAAA,IAC1B,IAAA;AAAA,IACA,IAAA,EAAM,EAAE,KAAO,EAAA,WAAA,EAAa,sBAAsB,EAAE,MAAA,EAAQ,UAAW,EAAA;AAAA,IACvE,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,UAAW,EAAA,CAAE,KAAK,CAAkB,cAAA,KAAA;AAClC,QAAA,OAAO,CAAC,KAAiC,KAAA;AACvC,UACE,uBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,aAAA;AAAA,YAAA;AAAA,cACE,GAAG,KAAA;AAAA,cACH,GAAG,cAAA;AAAA,cACJ,KAAA,EAAO,MAAM,KAAS,IAAA,KAAA;AAAA,cACtB;AAAA;AAAA,WACF;AAAA,SAEJ;AAAA,OACD;AAAA;AACL,GACD,CAAA;AACH;AAQA,SAAS,cAAiB,KAAuC,EAAA;AAC/D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,eAAA;AAAA,IACA,cAAA;AAAA,IACA,KAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AACJ,EAAA,MAAM,MAAM,MAAO,EAAA;AACnB,EAAA,MAAM,EAAE,QAAA,EAAa,GAAA,GAAA,CAAI,aAAc,EAAA;AACvC,EAAA,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MACC,IAAM,EAAA,YAAA;AAAA,MACN,aAAe,EAAA,KAAA;AAAA,MACf,KAAA,EAAO,MAAM,eAAA,CAAgB,KAAK;AAAA,KAAA;AAAA,wCAEjC,QAAS,EAAA,IAAA;AAAA,GAGd,kBAAA,KAAA,CAAA,aAAA,CAAC,OAAS,EAAA,EAAA,GAAG,YAAY,CAC3B,CAAA;AAGF,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAS,QAAU,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EAAA,EAC3B,eACC,mBAAA,KAAA,CAAA,aAAA,CAAC,eAAiB,EAAA,EAAA,GAAG,UAAa,EAAA,EAAA,YAAa,IAE/C,YAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"extensions.esm.js","sources":["../src/extensions.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 { useState, Suspense } from 'react';\nimport IconButton from '@material-ui/core/IconButton';\nimport SettingsIcon from '@material-ui/icons/Settings';\nimport { InfoCard } from '@backstage/core-components';\nimport { SettingsModal } from './components';\nimport { createReactExtension, useApp } from '@backstage/core-plugin-api';\nimport { RJSFSchema, UiSchema } from '@rjsf/utils';\n\n/**\n * @public\n */\nexport type ComponentRenderer = {\n Renderer?: (props: RendererProps) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type ComponentParts = {\n Content: (props?: any) => JSX.Element;\n Actions?: () => JSX.Element;\n Settings?: () => JSX.Element;\n ContextProvider?: (props: any) => JSX.Element;\n};\n\n/**\n * @public\n */\nexport type RendererProps = { title?: string } & ComponentParts;\n\n/**\n * @public\n */\nexport type CardExtensionProps<T> = ComponentRenderer & {\n title?: string;\n} & T;\n\n/**\n * @public\n */\nexport type CardLayout = {\n width?: { minColumns?: number; maxColumns?: number; defaultColumns?: number };\n height?: { minRows?: number; maxRows?: number; defaultRows?: number };\n};\n\n/**\n * @public\n */\nexport type CardSettings = {\n schema?: RJSFSchema;\n uiSchema?: UiSchema;\n};\n\n/**\n * @public\n */\nexport type CardConfig = {\n layout?: CardLayout;\n settings?: CardSettings;\n};\n\n/**\n * An extension creator to create card based components for the homepage\n *\n * @public\n */\nexport function createCardExtension<T>(options: {\n title?: string;\n components: () => Promise<ComponentParts>;\n name?: string;\n description?: string;\n layout?: CardLayout;\n settings?: CardSettings;\n}) {\n const { title, components, name, description, layout, settings } = options;\n // If widget settings schema is defined, we don't want to show the Settings icon or dialog\n const isCustomizable = settings?.schema !== undefined;\n\n return createReactExtension({\n name,\n data: { title, description, 'home.widget.config': { layout, settings } },\n component: {\n lazy: () =>\n components().then(componentParts => {\n return (props: CardExtensionProps<T>) => {\n return (\n <CardExtension\n {...props}\n {...componentParts}\n title={props.title || title}\n isCustomizable={isCustomizable}\n />\n );\n };\n }),\n },\n });\n}\n\ntype CardExtensionComponentProps<T> = CardExtensionProps<T> &\n ComponentParts & {\n isCustomizable?: boolean;\n overrideTitle?: string;\n };\n\nfunction CardExtension<T>(props: CardExtensionComponentProps<T>) {\n const {\n Renderer,\n Content,\n Settings,\n Actions,\n ContextProvider,\n isCustomizable,\n title,\n ...childProps\n } = props;\n const app = useApp();\n const { Progress } = app.getComponents();\n const [settingsOpen, setSettingsOpen] = useState(false);\n\n if (Renderer) {\n return (\n <Suspense fallback={<Progress />}>\n <Renderer\n {...(title && { title })}\n {...{\n Content,\n ...(Actions ? { Actions } : {}),\n ...(Settings && !isCustomizable ? { Settings } : {}),\n ...(ContextProvider ? { ContextProvider } : {}),\n ...childProps,\n }}\n />\n </Suspense>\n );\n }\n\n const cardProps = {\n divider: !!title,\n ...(title && { title }),\n ...(Settings && !isCustomizable\n ? {\n action: (\n <IconButton onClick={() => setSettingsOpen(true)}>\n <SettingsIcon>Settings</SettingsIcon>\n </IconButton>\n ),\n }\n : {}),\n ...(Actions\n ? {\n actions: <Actions />,\n }\n : {}),\n };\n\n const innerContent = (\n <InfoCard {...cardProps}>\n {Settings && !isCustomizable && (\n <SettingsModal\n open={settingsOpen}\n componentName={title}\n close={() => setSettingsOpen(false)}\n >\n <Settings />\n </SettingsModal>\n )}\n <Content {...childProps} />\n </InfoCard>\n );\n\n return (\n <Suspense fallback={<Progress />}>\n {ContextProvider ? (\n <ContextProvider {...childProps}>{innerContent}</ContextProvider>\n ) : (\n innerContent\n )}\n </Suspense>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAkFO,SAAS,oBAAuB,OAOpC,EAAA;AACD,EAAA,MAAM,EAAE,KAAO,EAAA,UAAA,EAAY,MAAM,WAAa,EAAA,MAAA,EAAQ,UAAa,GAAA,OAAA;AAEnE,EAAM,MAAA,cAAA,GAAiB,UAAU,MAAW,KAAA,KAAA,CAAA;AAE5C,EAAA,OAAO,oBAAqB,CAAA;AAAA,IAC1B,IAAA;AAAA,IACA,IAAA,EAAM,EAAE,KAAO,EAAA,WAAA,EAAa,sBAAsB,EAAE,MAAA,EAAQ,UAAW,EAAA;AAAA,IACvE,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,MACJ,UAAW,EAAA,CAAE,KAAK,CAAkB,cAAA,KAAA;AAClC,QAAA,OAAO,CAAC,KAAiC,KAAA;AACvC,UACE,uBAAA,GAAA;AAAA,YAAC,aAAA;AAAA,YAAA;AAAA,cACE,GAAG,KAAA;AAAA,cACH,GAAG,cAAA;AAAA,cACJ,KAAA,EAAO,MAAM,KAAS,IAAA,KAAA;AAAA,cACtB;AAAA;AAAA,WACF;AAAA,SAEJ;AAAA,OACD;AAAA;AACL,GACD,CAAA;AACH;AAQA,SAAS,cAAiB,KAAu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,IACL,GAAI,OACA,GAAA;AAAA,MACE,OAAA,sBAAU,OAAQ,EAAA,EAAA;AAAA,QAEpB;AAAC,GACP;AAEA,EAAA,MAAM,YACJ,mBAAA,IAAA,CAAC,QAAU,EAAA,EAAA,GAAG,SACX,EAAA,QAAA,EAAA;AAAA,IAAA,QAAA,IAAY,CAAC,cACZ,oBAAA,GAAA;AAAA,MAAC,aAAA;AAAA,MAAA;AAAA,QACC,IAAM,EAAA,YAAA;AAAA,QACN,aAAe,EAAA,KAAA;AAAA,QACf,KAAA,EAAO,MAAM,eAAA,CAAgB,KAAK,CAAA;AAAA,QAElC,8BAAC,QAAS,EAAA,EAAA;AAAA;AAAA,KACZ;AAAA,oBAEF,GAAA,CAAC,OAAS,EAAA,EAAA,GAAG,UAAY,EAAA;AAAA,GAC3B,EAAA,CAAA;AAGF,EAAA,uBACG,GAAA,CAAA,QAAA,EAAA,EAAS,QAAU,kBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,CAAA,EAC3B,QACC,EAAA,eAAA,mBAAA,GAAA,CAAC,eAAiB,EAAA,EAAA,GAAG,UAAa,EAAA,QAAA,EAAA,YAAA,EAAa,IAE/C,YAEJ,EAAA,CAAA;AAEJ;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
3
3
  import { RJSFSchema, UiSchema } from '@rjsf/utils';
4
4
 
@@ -8,7 +8,7 @@ declare const SettingsModal: (props: {
8
8
  close: Function;
9
9
  componentName?: string;
10
10
  children: JSX.Element;
11
- }) => React.JSX.Element;
11
+ }) => react_jsx_runtime.JSX.Element;
12
12
 
13
13
  /**
14
14
  * @public
@@ -78,6 +78,6 @@ declare function createCardExtension<T>(options: {
78
78
  description?: string;
79
79
  layout?: CardLayout;
80
80
  settings?: CardSettings;
81
- }): _backstage_core_plugin_api.Extension<(props: CardExtensionProps<T>) => React.JSX.Element>;
81
+ }): _backstage_core_plugin_api.Extension<(props: CardExtensionProps<T>) => react_jsx_runtime.JSX.Element>;
82
82
 
83
83
  export { type CardConfig, type CardExtensionProps, type CardLayout, type CardSettings, type ComponentParts, type ComponentRenderer, type RendererProps, SettingsModal, createCardExtension };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-home-react",
3
- "version": "0.1.25-next.0",
3
+ "version": "0.1.25-next.2",
4
4
  "description": "A Backstage plugin that contains react components helps you build a home page",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -42,14 +42,14 @@
42
42
  "test": "backstage-cli package test"
43
43
  },
44
44
  "dependencies": {
45
- "@backstage/core-components": "0.17.0",
46
- "@backstage/core-plugin-api": "1.10.5",
45
+ "@backstage/core-components": "0.17.1-next.1",
46
+ "@backstage/core-plugin-api": "1.10.6-next.0",
47
47
  "@material-ui/core": "^4.12.2",
48
48
  "@material-ui/icons": "^4.9.1",
49
49
  "@rjsf/utils": "5.23.2"
50
50
  },
51
51
  "devDependencies": {
52
- "@backstage/cli": "0.32.0-next.0",
52
+ "@backstage/cli": "0.32.0-next.2",
53
53
  "@types/react": "^18.0.0",
54
54
  "@types/react-grid-layout": "^1.3.2",
55
55
  "react": "^18.0.2",
@@ -67,5 +67,12 @@
67
67
  "optional": true
68
68
  }
69
69
  },
70
+ "typesVersions": {
71
+ "*": {
72
+ "package.json": [
73
+ "package.json"
74
+ ]
75
+ }
76
+ },
70
77
  "module": "./dist/index.esm.js"
71
78
  }