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

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,23 @@
1
1
  # @backstage/plugin-home-react
2
2
 
3
+ ## 0.1.25-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 2e4cb15: Fixes auto-hiding of content divider when title not specified
8
+ - Updated dependencies
9
+ - @backstage/core-components@0.17.0
10
+ - @backstage/core-plugin-api@1.10.5
11
+
12
+ ## 0.1.24
13
+
14
+ ### Patch Changes
15
+
16
+ - c5a82fc: Don't render header divider on homepage cards if no title was specified.
17
+ - Updated dependencies
18
+ - @backstage/core-components@0.17.0
19
+ - @backstage/core-plugin-api@1.10.5
20
+
3
21
  ## 0.1.24-next.1
4
22
 
5
23
  ### Patch Changes
@@ -58,7 +58,8 @@ function CardExtension(props) {
58
58
  ));
59
59
  }
60
60
  const cardProps = {
61
- ...title && { title, divider: !!title },
61
+ divider: !!title,
62
+ ...title && { title },
62
63
  ...Settings && !isCustomizable ? {
63
64
  action: /* @__PURE__ */ React.createElement(IconButton, { onClick: () => setSettingsOpen(true) }, /* @__PURE__ */ React.createElement(SettingsIcon, null, "Settings"))
64
65
  } : {},
@@ -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 ...(title && { title, divider: !!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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AAAA;AAIJ,EAAA,MAAM,SAAY,GAAA;AAAA,IAChB,GAAI,KAAS,IAAA,EAAE,OAAO,OAAS,EAAA,CAAC,CAAC,KAAM,EAAA;AAAA,IACvC,GAAI,QAAY,IAAA,CAAC,cACb,GAAA;AAAA,MACE,MAAA,kBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAS,EAAA,MAAM,eAAgB,CAAA,IAAI,CAC7C,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,IAAA,EAAA,UAAQ,CACxB;AAAA,QAGJ,EAAC;AAAA,IACL,GAAI,OACA,GAAA;AAAA,MACE,OAAA,sCAAU,OAAQ,EAAA,IAAA;AAAA,QAEpB;AAAC,GACP;AAEA,EAAA,MAAM,+BACH,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,EAAU,GAAG,SACX,EAAA,EAAA,QAAA,IAAY,CAAC,cACZ,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,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 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,W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,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;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-home-react",
3
- "version": "0.1.24-next.1",
3
+ "version": "0.1.25-next.0",
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.16.5-next.1",
46
- "@backstage/core-plugin-api": "1.10.4",
45
+ "@backstage/core-components": "0.17.0",
46
+ "@backstage/core-plugin-api": "1.10.5",
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.31.0-next.1",
52
+ "@backstage/cli": "0.32.0-next.0",
53
53
  "@types/react": "^18.0.0",
54
54
  "@types/react-grid-layout": "^1.3.2",
55
55
  "react": "^18.0.2",