@red-hat-developer-hub/backstage-plugin-theme 0.4.9 → 0.6.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 +20 -0
- package/config.d.ts +2 -1
- package/dist/backstage.esm.js.map +1 -1
- package/dist/components/ThemeProvider.esm.js.map +1 -1
- package/dist/darkTheme.esm.js +3 -1
- package/dist/darkTheme.esm.js.map +1 -1
- package/dist/fonts.esm.js.map +1 -1
- package/dist/hooks/useBranding.esm.js +1 -1
- package/dist/hooks/useBranding.esm.js.map +1 -1
- package/dist/hooks/useTheme.esm.js.map +1 -1
- package/dist/hooks/useThemeConfig.esm.js +2 -2
- package/dist/hooks/useThemeConfig.esm.js.map +1 -1
- package/dist/hooks/useThemeOptions.esm.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/lightTheme.esm.js +3 -1
- package/dist/lightTheme.esm.js.map +1 -1
- package/dist/rhdh.esm.js.map +1 -1
- package/dist/themes.esm.js +2 -2
- package/dist/themes.esm.js.map +1 -1
- package/dist/typography.esm.js.map +1 -1
- package/dist/utils/createComponents.esm.js +23 -1
- package/dist/utils/createComponents.esm.js.map +1 -1
- package/dist/utils/createPageTheme.esm.js.map +1 -1
- package/dist/utils/createPageThemes.esm.js +1 -1
- package/dist/utils/createPageThemes.esm.js.map +1 -1
- package/dist/utils/mergeTheme.esm.js +2 -2
- package/dist/utils/mergeTheme.esm.js.map +1 -1
- package/dist/utils/migrateTheme.esm.js.map +1 -1
- package/package.json +23 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @red-hat-developer-hub/backstage-plugin-theme
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 97ffc75: Backstage version bump to v1.36.1
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b1fc395: Some UI bug fix.
|
|
12
|
+
|
|
13
|
+
## 0.5.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- a571f32: Upgrade Backstage from 0.32.0 to 1.35.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 106b3d0: Fixing fontColor error while customizing rhdh appearance
|
|
22
|
+
|
|
3
23
|
## 0.4.9
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright Red Hat, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import { ThemeConfig } from './src';
|
|
17
18
|
|
|
18
19
|
export interface Config {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backstage.esm.js","sources":["../src/backstage.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"backstage.esm.js","sources":["../src/backstage.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { palettes } from '@backstage/theme';\n\nimport { ThemeConfig } from './types';\n\nexport const getDefaultThemeConfig = (mode: 'light' | 'dark'): ThemeConfig => {\n const palette = mode === 'dark' ? palettes.dark : palettes.light;\n\n return {\n variant: 'backstage',\n mode: mode === 'dark' ? 'dark' : 'light',\n palette,\n };\n};\n"],"names":[],"mappings":";;AAoBa,MAAA,qBAAA,GAAwB,CAAC,IAAwC,KAAA;AAC5E,EAAA,MAAM,OAAU,GAAA,IAAA,KAAS,MAAS,GAAA,QAAA,CAAS,OAAO,QAAS,CAAA,KAAA;AAE3D,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,WAAA;AAAA,IACT,IAAA,EAAM,IAAS,KAAA,MAAA,GAAS,MAAS,GAAA,OAAA;AAAA,IACjC;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.esm.js","sources":["../../src/components/ThemeProvider.tsx"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"ThemeProvider.esm.js","sources":["../../src/components/ThemeProvider.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { AppTheme } from '@backstage/core-plugin-api';\nimport { UnifiedTheme, UnifiedThemeProvider } from '@backstage/theme';\n\nimport {\n StyledEngineProvider,\n ThemeProvider as Mui5Provider,\n Theme as Mui5Theme,\n} from '@mui/material/styles';\n\nimport { useTheme } from '../hooks/useTheme';\nimport { useThemeConfig } from '../hooks/useThemeConfig';\nimport { ThemeConfig } from '../types';\n\n/**\n * Uses the UnifiedThemeProvider to style MUI v4 and v5 components.\n *\n * This component duplicated the StyledEngineProvider and MUI v5 ThemeProvider\n * to solve an issue that the defaultProps from the component configurations\n * (see `utils/createComponents.ts`) wasn't picked up.\n *\n * https://github.com/backstage/backstage/blob/master/packages/theme/src/unified/UnifiedThemeProvider.tsx#L94-L100\n */\nconst ThemeProvider = ({\n theme,\n children,\n}: {\n theme: UnifiedTheme;\n children: React.ReactNode;\n}) => (\n <UnifiedThemeProvider theme={theme}>\n <StyledEngineProvider injectFirst>\n <Mui5Provider theme={theme.getTheme('v5') as Mui5Theme}>\n {children}\n </Mui5Provider>\n </StyledEngineProvider>\n </UnifiedThemeProvider>\n);\n\nexport const createThemeProvider = (\n theme: UnifiedTheme,\n): AppTheme['Provider'] =>\n function RHDHThemeProvider({ children }) {\n return <ThemeProvider theme={theme}>{children}</ThemeProvider>;\n };\n\nexport const createThemeProviderForThemeConfig = (\n themeConfig: ThemeConfig,\n): AppTheme['Provider'] =>\n function RHDHThemeProviderForThemeConfig({ children }) {\n const theme = useTheme(themeConfig);\n return <ThemeProvider theme={theme}>{children}</ThemeProvider>;\n };\n\nexport const createThemeProviderForThemeName = (\n themeName: string,\n): AppTheme['Provider'] =>\n function RHDHThemeProviderForThemeName({ children }) {\n const themeConfig = useThemeConfig(themeName);\n const theme = useTheme(themeConfig);\n return <ThemeProvider theme={theme}>{children}</ThemeProvider>;\n };\n"],"names":["Mui5Provider"],"mappings":";;;;;;AAuCA,MAAM,gBAAgB,CAAC;AAAA,EACrB,KAAA;AAAA,EACA;AACF,CAAA,yCAIG,oBAAqB,EAAA,EAAA,KAAA,EAAA,kBACnB,KAAA,CAAA,aAAA,CAAA,oBAAA,EAAA,EAAqB,aAAW,IAC/B,EAAA,kBAAA,KAAA,CAAA,aAAA,CAACA,eAAa,EAAA,EAAA,KAAA,EAAO,MAAM,QAAS,CAAA,IAAI,CACrC,EAAA,EAAA,QACH,CACF,CACF,CAAA;AAGK,MAAM,sBAAsB,CACjC,KAAA,KAEA,SAAS,iBAAkB,CAAA,EAAE,UAAY,EAAA;AACvC,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,KAAA,EAAA,EAAe,QAAS,CAAA;AAChD;AAEK,MAAM,oCAAoC,CAC/C,WAAA,KAEA,SAAS,+BAAgC,CAAA,EAAE,UAAY,EAAA;AACrD,EAAM,MAAA,KAAA,GAAQ,SAAS,WAAW,CAAA;AAClC,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,KAAA,EAAA,EAAe,QAAS,CAAA;AAChD;AAEK,MAAM,kCAAkC,CAC7C,SAAA,KAEA,SAAS,6BAA8B,CAAA,EAAE,UAAY,EAAA;AACnD,EAAM,MAAA,WAAA,GAAc,eAAe,SAAS,CAAA;AAC5C,EAAM,MAAA,KAAA,GAAQ,SAAS,WAAW,CAAA;AAClC,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,EAAA,KAAA,EAAA,EAAe,QAAS,CAAA;AAChD;;;;"}
|
package/dist/darkTheme.esm.js
CHANGED
|
@@ -49,7 +49,9 @@ const customDarkTheme = () => {
|
|
|
49
49
|
tableBackgroundColor: "#1b1d21",
|
|
50
50
|
tabsDisabledBackgroundColor: "#444548",
|
|
51
51
|
tabsBottomBorderColor: "#444548",
|
|
52
|
-
contrastText: "#FFF"
|
|
52
|
+
contrastText: "#FFF",
|
|
53
|
+
appBarBackgroundColor: "#1b1d21",
|
|
54
|
+
appBarBackgroundImage: "none"
|
|
53
55
|
},
|
|
54
56
|
primary: {
|
|
55
57
|
main: "#1FA7F8",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"darkTheme.esm.js","sources":["../src/darkTheme.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"darkTheme.esm.js","sources":["../src/darkTheme.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { palettes } from '@backstage/theme';\nimport { type PaletteOptions } from '@mui/material/styles';\n\nimport { type ThemeConfigPalette } from './types';\n\nexport const customDarkTheme = (): ThemeConfigPalette => {\n const palette: (typeof palettes)['dark'] & PaletteOptions = palettes.dark;\n return {\n ...palette,\n primary: {\n main: '#1FA7F8',\n },\n secondary: {\n main: '#1FA7F8',\n },\n navigation: {\n background: '#0f1214',\n indicator: '#0066CC',\n color: '#ffffff',\n selectedColor: '#ffffff',\n navItem: {\n hoverBackground: '#3c3f42',\n },\n submenu: {\n background: '#0f1214',\n },\n },\n background: {\n default: '#333333',\n paper: '#1b1d21',\n },\n rhdh: {\n general: {\n disabled: '#AAABAC',\n disabledBackground: '#444548',\n\n paperBackgroundImage: 'none',\n paperBorderColor: '#A3A3A3',\n\n // Box shadow from PatternFly 5 (--pf-v5-global--BoxShadow--sm)\n popoverBoxShadow:\n '0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.48), 0 0 0.25rem 0 rgba(3, 3, 3, 0.24)',\n\n cardBackgroundColor: '#1b1d21',\n cardBorderColor: '#A3A3A3',\n\n headerBottomBorderColor: '#A3A3A3',\n mainSectionBackgroundColor: '#0f1214',\n formControlBackgroundColor: '#36373A',\n\n sidebarBackgroundColor: '#1b1d21',\n sidebarItemSelectedBackgroundColor: '#4F5255',\n\n tableTitleColor: '#E0E0E0',\n tableSubtitleColor: '#E0E0E0',\n tableColumnTitleColor: '#E0E0E0',\n tableRowHover: '#0f1214',\n tableBorderColor: '#515151',\n tableBackgroundColor: '#1b1d21',\n tabsDisabledBackgroundColor: '#444548',\n tabsBottomBorderColor: '#444548',\n\n contrastText: '#FFF',\n\n appBarBackgroundColor: '#1b1d21',\n appBarBackgroundImage: 'none',\n },\n primary: {\n main: '#1FA7F8',\n focusVisibleBorder: '#ADD6FF',\n },\n secondary: {\n main: '#1FA7F8',\n focusVisibleBorder: '#ADD6FF',\n },\n cards: {\n headerTextColor: '#FFF',\n headerBackgroundColor: '#0f1214',\n headerBackgroundImage: 'none',\n },\n },\n };\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,kBAAkB,MAA0B;AACvD,EAAA,MAAM,UAAsD,QAAS,CAAA,IAAA;AACrE,EAAO,OAAA;AAAA,IACL,GAAG,OAAA;AAAA,IACH,OAAS,EAAA;AAAA,MACP,IAAM,EAAA;AAAA,KACR;AAAA,IACA,SAAW,EAAA;AAAA,MACT,IAAM,EAAA;AAAA,KACR;AAAA,IACA,UAAY,EAAA;AAAA,MACV,UAAY,EAAA,SAAA;AAAA,MACZ,SAAW,EAAA,SAAA;AAAA,MACX,KAAO,EAAA,SAAA;AAAA,MACP,aAAe,EAAA,SAAA;AAAA,MACf,OAAS,EAAA;AAAA,QACP,eAAiB,EAAA;AAAA,OACnB;AAAA,MACA,OAAS,EAAA;AAAA,QACP,UAAY,EAAA;AAAA;AACd,KACF;AAAA,IACA,UAAY,EAAA;AAAA,MACV,OAAS,EAAA,SAAA;AAAA,MACT,KAAO,EAAA;AAAA,KACT;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA;AAAA,QACP,QAAU,EAAA,SAAA;AAAA,QACV,kBAAoB,EAAA,SAAA;AAAA,QAEpB,oBAAsB,EAAA,MAAA;AAAA,QACtB,gBAAkB,EAAA,SAAA;AAAA;AAAA,QAGlB,gBACE,EAAA,8EAAA;AAAA,QAEF,mBAAqB,EAAA,SAAA;AAAA,QACrB,eAAiB,EAAA,SAAA;AAAA,QAEjB,uBAAyB,EAAA,SAAA;AAAA,QACzB,0BAA4B,EAAA,SAAA;AAAA,QAC5B,0BAA4B,EAAA,SAAA;AAAA,QAE5B,sBAAwB,EAAA,SAAA;AAAA,QACxB,kCAAoC,EAAA,SAAA;AAAA,QAEpC,eAAiB,EAAA,SAAA;AAAA,QACjB,kBAAoB,EAAA,SAAA;AAAA,QACpB,qBAAuB,EAAA,SAAA;AAAA,QACvB,aAAe,EAAA,SAAA;AAAA,QACf,gBAAkB,EAAA,SAAA;AAAA,QAClB,oBAAsB,EAAA,SAAA;AAAA,QACtB,2BAA6B,EAAA,SAAA;AAAA,QAC7B,qBAAuB,EAAA,SAAA;AAAA,QAEvB,YAAc,EAAA,MAAA;AAAA,QAEd,qBAAuB,EAAA,SAAA;AAAA,QACvB,qBAAuB,EAAA;AAAA,OACzB;AAAA,MACA,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,SAAW,EAAA;AAAA,QACT,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,KAAO,EAAA;AAAA,QACL,eAAiB,EAAA,MAAA;AAAA,QACjB,qBAAuB,EAAA,SAAA;AAAA,QACvB,qBAAuB,EAAA;AAAA;AACzB;AACF,GACF;AACF;;;;"}
|
package/dist/fonts.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.esm.js","sources":["../src/fonts.tsx"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"fonts.esm.js","sources":["../src/fonts.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 RedHatDisplay from './assets/fonts/RedHatDisplay/RedHatDisplayVF.woff2';\nimport RedHatDisplayItalic from './assets/fonts/RedHatDisplay/RedHatDisplayVF-Italic.woff2';\nimport RedHatText from './assets/fonts/RedHatText/RedHatTextVF.woff2';\nimport RedHatTextItalic from './assets/fonts/RedHatText/RedHatTextVF-Italic.woff2';\nimport RedHatMono from './assets/fonts/RedHatMono/RedHatMonoVF.woff2';\nimport RedHatMonoItalic from './assets/fonts/RedHatMono/RedHatMonoVF-Italic.woff2';\n\nconst RedHatDisplayFontFace = {\n fontFamily: 'RedHatDisplay',\n src: `url(${RedHatDisplay}) format('woff2-variations')`,\n fontWeight: '300 900',\n fontStyle: 'normal',\n fontDisplay: 'fallback',\n};\n\nconst RedHatDisplayItalicFontFace = {\n fontFamily: 'RedHatDisplay',\n src: `url(${RedHatDisplayItalic}) format('woff2-variations')`,\n fontWeight: '300 900',\n fontStyle: 'italic',\n fontDisplay: 'fallback',\n};\n\nexport const RedHatTextFontFace = {\n fontFamily: 'RedHatText',\n src: `url(${RedHatText}) format('woff2-variations')`,\n fontWeight: '300 700',\n fontStyle: 'normal',\n fontDisplay: 'fallback',\n};\n\nconst RedHatTextItalicFontFace = {\n fontFamily: 'RedHatText',\n src: `url(${RedHatTextItalic}) format('woff2-variations')`,\n fontWeight: '300 700',\n fontStyle: 'italic',\n fontDisplay: 'fallback',\n};\n\nconst RedHatMonoFontFace = {\n fontFamily: 'RedHatMono',\n src: `url(${RedHatMono}) format('woff2-variations')`,\n fontWeight: '300 700',\n fontStyle: 'normal',\n fontDisplay: 'fallback',\n};\n\nconst RedHatMonoItalicFontFace = {\n fontFamily: 'RedHatMono',\n src: `url(${RedHatMonoItalic}) format('woff2-variations')`,\n fontWeight: '300 700',\n fontStyle: 'italic',\n fontDisplay: 'fallback',\n};\n\nexport const redHatFontFaces = [\n RedHatDisplayFontFace,\n RedHatDisplayItalicFontFace,\n RedHatTextFontFace,\n RedHatTextItalicFontFace,\n RedHatMonoFontFace,\n RedHatMonoItalicFontFace,\n];\n\nexport const redHatFonts = {\n text: [\n 'RedHatText',\n '\"Helvetica Neue\"',\n '-apple-system',\n '\"Segoe UI\"',\n 'Roboto',\n 'Helvetica',\n 'Arial',\n 'sans-serif',\n ].join(', '),\n heading: [\n 'RedHatDisplay',\n '\"Helvetica Neue\"',\n '-apple-system',\n '\"Segoe UI\"',\n 'Roboto',\n 'Helvetica',\n 'Arial',\n 'sans-serif',\n ].join(', '),\n monospace: [\n 'RedHatMono',\n '\"Liberation Mono\"',\n 'consolas',\n '\"SFMono-Regular\"',\n 'menlo',\n 'monaco',\n '\"Courier New\"',\n 'monospace',\n ].join(', '),\n};\n"],"names":[],"mappings":";;;;;;;AAuBA,MAAM,qBAAwB,GAAA;AAAA,EAC5B,UAAY,EAAA,eAAA;AAAA,EACZ,GAAA,EAAK,OAAO,aAAa,CAAA,4BAAA,CAAA;AAAA,EACzB,UAAY,EAAA,SAAA;AAAA,EACZ,SAAW,EAAA,QAAA;AAAA,EACX,WAAa,EAAA;AACf,CAAA;AAEA,MAAM,2BAA8B,GAAA;AAAA,EAClC,UAAY,EAAA,eAAA;AAAA,EACZ,GAAA,EAAK,OAAO,mBAAmB,CAAA,4BAAA,CAAA;AAAA,EAC/B,UAAY,EAAA,SAAA;AAAA,EACZ,SAAW,EAAA,QAAA;AAAA,EACX,WAAa,EAAA;AACf,CAAA;AAEO,MAAM,kBAAqB,GAAA;AAAA,EAChC,UAAY,EAAA,YAAA;AAAA,EACZ,GAAA,EAAK,OAAO,UAAU,CAAA,4BAAA,CAAA;AAAA,EACtB,UAAY,EAAA,SAAA;AAAA,EACZ,SAAW,EAAA,QAAA;AAAA,EACX,WAAa,EAAA;AACf;AAEA,MAAM,wBAA2B,GAAA;AAAA,EAC/B,UAAY,EAAA,YAAA;AAAA,EACZ,GAAA,EAAK,OAAO,gBAAgB,CAAA,4BAAA,CAAA;AAAA,EAC5B,UAAY,EAAA,SAAA;AAAA,EACZ,SAAW,EAAA,QAAA;AAAA,EACX,WAAa,EAAA;AACf,CAAA;AAEA,MAAM,kBAAqB,GAAA;AAAA,EACzB,UAAY,EAAA,YAAA;AAAA,EACZ,GAAA,EAAK,OAAO,UAAU,CAAA,4BAAA,CAAA;AAAA,EACtB,UAAY,EAAA,SAAA;AAAA,EACZ,SAAW,EAAA,QAAA;AAAA,EACX,WAAa,EAAA;AACf,CAAA;AAEA,MAAM,wBAA2B,GAAA;AAAA,EAC/B,UAAY,EAAA,YAAA;AAAA,EACZ,GAAA,EAAK,OAAO,gBAAgB,CAAA,4BAAA,CAAA;AAAA,EAC5B,UAAY,EAAA,SAAA;AAAA,EACZ,SAAW,EAAA,QAAA;AAAA,EACX,WAAa,EAAA;AACf,CAAA;AAEO,MAAM,eAAkB,GAAA;AAAA,EAC7B,qBAAA;AAAA,EACA,2BAAA;AAAA,EACA,kBAAA;AAAA,EACA,wBAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF;AAEO,MAAM,WAAc,GAAA;AAAA,EACzB,IAAM,EAAA;AAAA,IACJ,YAAA;AAAA,IACA,kBAAA;AAAA,IACA,eAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF,CAAE,KAAK,IAAI,CAAA;AAAA,EACX,OAAS,EAAA;AAAA,IACP,eAAA;AAAA,IACA,kBAAA;AAAA,IACA,eAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA;AAAA,GACF,CAAE,KAAK,IAAI,CAAA;AAAA,EACX,SAAW,EAAA;AAAA,IACT,YAAA;AAAA,IACA,mBAAA;AAAA,IACA,UAAA;AAAA,IACA,kBAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,GACF,CAAE,KAAK,IAAI;AACb;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBranding.esm.js","sources":["../../src/hooks/useBranding.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"useBranding.esm.js","sources":["../../src/hooks/useBranding.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { ConfigApi, configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { Branding } from '../types';\n\nexport const useBranding = (): Branding | undefined => {\n let configApi: ConfigApi | undefined = undefined;\n try {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n configApi = useApi(configApiRef);\n } catch (err) {\n // useApi won't be initialized initially in createApp theme provider, and will get updated later\n }\n return React.useMemo(() => {\n const branding = configApi?.getOptional<Branding>('app.branding');\n return branding;\n }, [configApi]);\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,cAAc,MAA4B;AACrD,EAAA,IAAI,SAAmC,GAAA,SAAA;AACvC,EAAI,IAAA;AAEF,IAAA,SAAA,GAAY,OAAO,YAAY,CAAA;AAAA,WACxB,GAAK,EAAA;AAAA;AAGd,EAAO,OAAA,KAAA,CAAM,QAAQ,MAAM;AACzB,IAAM,MAAA,QAAA,GAAW,SAAW,EAAA,WAAA,CAAsB,cAAc,CAAA;AAChE,IAAO,OAAA,QAAA;AAAA,GACT,EAAG,CAAC,SAAS,CAAC,CAAA;AAChB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.esm.js","sources":["../../src/hooks/useTheme.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"useTheme.esm.js","sources":["../../src/hooks/useTheme.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { createUnifiedTheme, type UnifiedTheme } from '@backstage/theme';\nimport type { ThemeConfig } from '../types';\nimport { useThemeOptions } from './useThemeOptions';\n\n/** Creates a memorized Backstage UnifiedTheme based on the given ThemeConfig. */\nexport const useTheme = (themeConfig: ThemeConfig): UnifiedTheme => {\n const unifiedThemeOptions = useThemeOptions(themeConfig);\n const theme = React.useMemo<UnifiedTheme>(\n () => createUnifiedTheme(unifiedThemeOptions),\n [unifiedThemeOptions],\n );\n return theme;\n};\n"],"names":[],"mappings":";;;;AAsBa,MAAA,QAAA,GAAW,CAAC,WAA2C,KAAA;AAClE,EAAM,MAAA,mBAAA,GAAsB,gBAAgB,WAAW,CAAA;AACvD,EAAA,MAAM,QAAQ,KAAM,CAAA,OAAA;AAAA,IAClB,MAAM,mBAAmB,mBAAmB,CAAA;AAAA,IAC5C,CAAC,mBAAmB;AAAA,GACtB;AACA,EAAO,OAAA,KAAA;AACT;;;;"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
3
3
|
|
|
4
4
|
const useThemeConfig = (themeName) => {
|
|
5
|
-
let configApi =
|
|
5
|
+
let configApi = undefined;
|
|
6
6
|
try {
|
|
7
7
|
configApi = useApi(configApiRef);
|
|
8
8
|
} catch (err) {
|
|
@@ -17,7 +17,7 @@ const useThemeConfig = (themeName) => {
|
|
|
17
17
|
if (!themeConfig.mode) {
|
|
18
18
|
themeConfig.mode = themeName.includes("dark") ? "dark" : "light";
|
|
19
19
|
}
|
|
20
|
-
if (Array.isArray(themeConfig?.pageTheme?.default
|
|
20
|
+
if (Array.isArray(themeConfig?.pageTheme?.default?.fontColor)) {
|
|
21
21
|
themeConfig.pageTheme.default.fontColor = themeConfig.pageTheme.default.fontColor[0];
|
|
22
22
|
}
|
|
23
23
|
return themeConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeConfig.esm.js","sources":["../../src/hooks/useThemeConfig.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"useThemeConfig.esm.js","sources":["../../src/hooks/useThemeConfig.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { ConfigApi, configApiRef, useApi } from '@backstage/core-plugin-api';\nimport { ThemeConfig } from '../types';\n\nexport const useThemeConfig = (themeName: string): ThemeConfig => {\n let configApi: ConfigApi | undefined = undefined;\n try {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n configApi = useApi<ConfigApi>(configApiRef); // NOSONAR\n } catch (err) {\n // useApi won't be initialized initially in createApp theme provider, and will get updated later\n }\n return React.useMemo(() => {\n if (!configApi) {\n return {\n mode: themeName.includes('dark') ? 'dark' : 'light',\n };\n }\n const themeConfig =\n configApi.getOptional<ThemeConfig>(`app.branding.theme.${themeName}`) ??\n {};\n if (!themeConfig.mode) {\n themeConfig.mode = themeName.includes('dark') ? 'dark' : 'light';\n }\n\n if (Array.isArray(themeConfig?.pageTheme?.default?.fontColor)) {\n themeConfig.pageTheme.default.fontColor =\n themeConfig.pageTheme.default.fontColor[0];\n }\n\n return themeConfig;\n }, [themeName, configApi]);\n};\n"],"names":[],"mappings":";;;AAoBa,MAAA,cAAA,GAAiB,CAAC,SAAmC,KAAA;AAChE,EAAA,IAAI,SAAmC,GAAA,SAAA;AACvC,EAAI,IAAA;AAEF,IAAA,SAAA,GAAY,OAAkB,YAAY,CAAA;AAAA,WACnC,GAAK,EAAA;AAAA;AAGd,EAAO,OAAA,KAAA,CAAM,QAAQ,MAAM;AACzB,IAAA,IAAI,CAAC,SAAW,EAAA;AACd,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,SAAA,CAAU,QAAS,CAAA,MAAM,IAAI,MAAS,GAAA;AAAA,OAC9C;AAAA;AAEF,IAAA,MAAM,cACJ,SAAU,CAAA,WAAA,CAAyB,sBAAsB,SAAS,CAAA,CAAE,KACpE,EAAC;AACH,IAAI,IAAA,CAAC,YAAY,IAAM,EAAA;AACrB,MAAA,WAAA,CAAY,IAAO,GAAA,SAAA,CAAU,QAAS,CAAA,MAAM,IAAI,MAAS,GAAA,OAAA;AAAA;AAG3D,IAAA,IAAI,MAAM,OAAQ,CAAA,WAAA,EAAa,SAAW,EAAA,OAAA,EAAS,SAAS,CAAG,EAAA;AAC7D,MAAA,WAAA,CAAY,UAAU,OAAQ,CAAA,SAAA,GAC5B,YAAY,SAAU,CAAA,OAAA,CAAQ,UAAU,CAAC,CAAA;AAAA;AAG7C,IAAO,OAAA,WAAA;AAAA,GACN,EAAA,CAAC,SAAW,EAAA,SAAS,CAAC,CAAA;AAC3B;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeOptions.esm.js","sources":["../../src/hooks/useThemeOptions.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"useThemeOptions.esm.js","sources":["../../src/hooks/useThemeOptions.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { type UnifiedThemeOptions } from '@backstage/theme';\nimport type { ThemeConfig } from '../types';\nimport * as backstage from '../backstage';\nimport * as rhdh from '../rhdh';\nimport { migrateThemeConfig } from '../utils/migrateTheme';\nimport { mergeUnifiedThemeOptions } from '../utils/mergeTheme';\nimport { createPageThemes } from '../utils/createPageThemes';\nimport { createComponents } from '../utils/createComponents';\n\n/** Creates a memorized Backstage UnifiedThemeOptions based on the given ThemeConfig. */\nexport const useThemeOptions = (\n themeConfig: ThemeConfig,\n): UnifiedThemeOptions => {\n const theme = React.useMemo<UnifiedThemeOptions>(() => {\n const mode = themeConfig.mode ?? 'light';\n const variant = themeConfig.variant ?? 'rhdh';\n\n let defaultThemeConfig: ThemeConfig;\n if (variant === 'backstage') {\n defaultThemeConfig = backstage.getDefaultThemeConfig(mode);\n } else {\n defaultThemeConfig = rhdh.getDefaultThemeConfig(mode);\n }\n\n const migratedThemeConfig = migrateThemeConfig(themeConfig);\n const mergedThemeConfig = mergeUnifiedThemeOptions(\n defaultThemeConfig,\n migratedThemeConfig,\n );\n\n const unifiedThemeOption: UnifiedThemeOptions = {\n palette: mergedThemeConfig.palette as UnifiedThemeOptions['palette'],\n defaultPageTheme: mergedThemeConfig.defaultPageTheme,\n fontFamily: mergedThemeConfig.fontFamily,\n htmlFontSize: mergedThemeConfig.htmlFontSize,\n typography: mergedThemeConfig.typography,\n };\n\n unifiedThemeOption.pageTheme = createPageThemes(mergedThemeConfig);\n\n if (variant !== 'backstage') {\n unifiedThemeOption.components = createComponents(mergedThemeConfig);\n }\n\n return unifiedThemeOption;\n }, [themeConfig]);\n return theme;\n};\n"],"names":["backstage.getDefaultThemeConfig","rhdh.getDefaultThemeConfig"],"mappings":";;;;;;;;AA2Ba,MAAA,eAAA,GAAkB,CAC7B,WACwB,KAAA;AACxB,EAAM,MAAA,KAAA,GAAQ,KAAM,CAAA,OAAA,CAA6B,MAAM;AACrD,IAAM,MAAA,IAAA,GAAO,YAAY,IAAQ,IAAA,OAAA;AACjC,IAAM,MAAA,OAAA,GAAU,YAAY,OAAW,IAAA,MAAA;AAEvC,IAAI,IAAA,kBAAA;AACJ,IAAA,IAAI,YAAY,WAAa,EAAA;AAC3B,MAAqB,kBAAA,GAAAA,sBAAgC,IAAI,CAAA;AAAA,KACpD,MAAA;AACL,MAAqB,kBAAA,GAAAC,wBAA2B,IAAI,CAAA;AAAA;AAGtD,IAAM,MAAA,mBAAA,GAAsB,mBAAmB,WAAW,CAAA;AAC1D,IAAA,MAAM,iBAAoB,GAAA,wBAAA;AAAA,MACxB,kBAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,MAAM,kBAA0C,GAAA;AAAA,MAC9C,SAAS,iBAAkB,CAAA,OAAA;AAAA,MAC3B,kBAAkB,iBAAkB,CAAA,gBAAA;AAAA,MACpC,YAAY,iBAAkB,CAAA,UAAA;AAAA,MAC9B,cAAc,iBAAkB,CAAA,YAAA;AAAA,MAChC,YAAY,iBAAkB,CAAA;AAAA,KAChC;AAEA,IAAmB,kBAAA,CAAA,SAAA,GAAY,iBAAiB,iBAAiB,CAAA;AAEjE,IAAA,IAAI,YAAY,WAAa,EAAA;AAC3B,MAAmB,kBAAA,CAAA,UAAA,GAAa,iBAAiB,iBAAiB,CAAA;AAAA;AAGpE,IAAO,OAAA,kBAAA;AAAA,GACT,EAAG,CAAC,WAAW,CAAC,CAAA;AAChB,EAAO,OAAA,KAAA;AACT;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ interface RHDHThemePalette {
|
|
|
28
28
|
tabsDisabledBackgroundColor: string;
|
|
29
29
|
tabsBottomBorderColor: string;
|
|
30
30
|
contrastText: string;
|
|
31
|
+
appBarBackgroundColor: string;
|
|
32
|
+
appBarBackgroundImage: string;
|
|
31
33
|
};
|
|
32
34
|
primary: {
|
|
33
35
|
main: string;
|
|
@@ -69,6 +71,7 @@ interface ThemeConfigOptions {
|
|
|
69
71
|
cards?: 'patternfly' | 'mui';
|
|
70
72
|
tables?: 'patternfly' | 'mui';
|
|
71
73
|
tabs?: 'patternfly' | 'mui';
|
|
74
|
+
appBar?: 'patternfly' | 'mui';
|
|
72
75
|
}
|
|
73
76
|
interface ThemeConfig {
|
|
74
77
|
/** Optional key to load different defaults. Fallbacks to the latest `rhdh` theme if not defined. */
|
package/dist/lightTheme.esm.js
CHANGED
|
@@ -53,7 +53,9 @@ const customLightTheme = () => {
|
|
|
53
53
|
tableBackgroundColor: "#FFF",
|
|
54
54
|
tabsDisabledBackgroundColor: "#f5f5f5",
|
|
55
55
|
tabsBottomBorderColor: "#D2D2D2",
|
|
56
|
-
contrastText: "#FFF"
|
|
56
|
+
contrastText: "#FFF",
|
|
57
|
+
appBarBackgroundColor: "#212427",
|
|
58
|
+
appBarBackgroundImage: "none"
|
|
57
59
|
},
|
|
58
60
|
primary: {
|
|
59
61
|
main: "#0066CC",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lightTheme.esm.js","sources":["../src/lightTheme.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"lightTheme.esm.js","sources":["../src/lightTheme.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { palettes } from '@backstage/theme';\nimport { type PaletteOptions } from '@mui/material/styles';\n\nimport { type ThemeConfigPalette } from './types';\n\nexport const customLightTheme = (): ThemeConfigPalette => {\n const palette: (typeof palettes)['light'] & PaletteOptions = palettes.light;\n return {\n ...palette,\n primary: {\n main: '#0066CC',\n },\n secondary: {\n main: '#0066CC',\n },\n navigation: {\n background: '#222427',\n indicator: '#0066CC',\n color: '#ffffff',\n selectedColor: '#ffffff',\n navItem: {\n hoverBackground: '#3c3f42',\n },\n submenu: {\n background: '#222427',\n },\n },\n text: {\n primary: '#151515',\n secondary: '#757575',\n },\n background: {\n default: '#F8F8F8',\n paper: '#FFFFFF',\n },\n rhdh: {\n general: {\n disabled: '#6A6E73',\n disabledBackground: '#D2D2D2',\n\n paperBackgroundImage: 'none',\n paperBorderColor: '#C7C7C7',\n\n // Box shadow from PatternFly 5 (--pf-v5-global--BoxShadow--sm)\n popoverBoxShadow:\n '0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)',\n\n cardBackgroundColor: '#FFF',\n cardBorderColor: '#C7C7C7',\n\n headerBottomBorderColor: '#C7C7C7',\n mainSectionBackgroundColor: '#FFF',\n formControlBackgroundColor: '#FFF',\n\n sidebarBackgroundColor: '#212427',\n sidebarItemSelectedBackgroundColor: '#4F5255',\n\n tableTitleColor: '#181818',\n tableSubtitleColor: '#616161',\n tableColumnTitleColor: '#151515',\n tableRowHover: '#F5F5F5',\n tableBorderColor: '#E0E0E0',\n tableBackgroundColor: '#FFF',\n tabsDisabledBackgroundColor: '#f5f5f5',\n tabsBottomBorderColor: '#D2D2D2',\n\n contrastText: '#FFF',\n\n appBarBackgroundColor: '#212427',\n appBarBackgroundImage: 'none',\n },\n primary: {\n main: '#0066CC',\n focusVisibleBorder: '#0066CC',\n },\n secondary: {\n main: '#0066CC',\n focusVisibleBorder: '#0066CC',\n },\n cards: {\n headerTextColor: '#151515',\n headerBackgroundColor: '#FFF',\n headerBackgroundImage: 'none',\n },\n },\n };\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,mBAAmB,MAA0B;AACxD,EAAA,MAAM,UAAuD,QAAS,CAAA,K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tB,2BAA6B,EAAA,SAAA;AAAA,QAC7B,qBAAuB,EAAA,SAAA;AAAA,QAEvB,YAAc,EAAA,MAAA;AAAA,QAEd,qBAAuB,EAAA,SAAA;AAAA,QACvB,qBAAuB,EAAA;AAAA,OACzB;AAAA,MACA,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,SAAW,EAAA;AAAA,QACT,IAAM,EAAA,SAAA;AAAA,QACN,kBAAoB,EAAA;AAAA,OACtB;AAAA,MACA,KAAO,EAAA;AAAA,QACL,eAAiB,EAAA,SAAA;AAAA,QACjB,qBAAuB,EAAA,MAAA;AAAA,QACvB,qBAAuB,EAAA;AAAA;AACzB;AACF,GACF;AACF;;;;"}
|
package/dist/rhdh.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rhdh.esm.js","sources":["../src/rhdh.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"rhdh.esm.js","sources":["../src/rhdh.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { ThemeConfig } from './types';\nimport { customDarkTheme } from './darkTheme';\nimport { customLightTheme } from './lightTheme';\nimport { redHatFonts } from './fonts';\nimport { typography } from './typography';\n\nexport const getDefaultThemeConfig = (mode: 'light' | 'dark'): ThemeConfig => {\n const palette = mode === 'dark' ? customDarkTheme() : customLightTheme();\n\n return {\n variant: 'rhdh',\n mode: mode === 'dark' ? 'dark' : 'light',\n palette,\n fontFamily: redHatFonts.text,\n typography,\n defaultPageTheme: 'default',\n pageTheme: {\n default: {\n backgroundColor: mode === 'dark' ? '#0f1214' : '#ffffff',\n fontColor: mode === 'dark' ? '#ffffff' : '#000000',\n },\n },\n options: {},\n };\n};\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,qBAAA,GAAwB,CAAC,IAAwC,KAAA;AAC5E,EAAA,MAAM,OAAU,GAAA,IAAA,KAAS,MAAS,GAAA,eAAA,KAAoB,gBAAiB,EAAA;AAEvE,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,MAAA;AAAA,IACT,IAAA,EAAM,IAAS,KAAA,MAAA,GAAS,MAAS,GAAA,OAAA;AAAA,IACjC,OAAA;AAAA,IACA,YAAY,WAAY,CAAA,IAAA;AAAA,IACxB,UAAA;AAAA,IACA,gBAAkB,EAAA,SAAA;AAAA,IAClB,SAAW,EAAA;AAAA,MACT,OAAS,EAAA;AAAA,QACP,eAAA,EAAiB,IAAS,KAAA,MAAA,GAAS,SAAY,GAAA,SAAA;AAAA,QAC/C,SAAA,EAAW,IAAS,KAAA,MAAA,GAAS,SAAY,GAAA;AAAA;AAC3C,KACF;AAAA,IACA,SAAS;AAAC,GACZ;AACF;;;;"}
|
package/dist/themes.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { themes } from '@backstage/theme';
|
|
3
|
-
import LightIcon from '@
|
|
4
|
-
import DarkIcon from '@
|
|
3
|
+
import LightIcon from '@mui/icons-material/WbSunnyRounded';
|
|
4
|
+
import DarkIcon from '@mui/icons-material/Brightness2Rounded';
|
|
5
5
|
import { createTheme } from '@mui/material/styles';
|
|
6
6
|
import { createThemeProviderForThemeName, createThemeProviderForThemeConfig, createThemeProvider } from './components/ThemeProvider.esm.js';
|
|
7
7
|
import { getDefaultThemeConfig } from './backstage.esm.js';
|
package/dist/themes.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.esm.js","sources":["../src/themes.tsx"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"themes.esm.js","sources":["../src/themes.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { AppTheme } from '@backstage/core-plugin-api';\nimport { themes } from '@backstage/theme';\n\nimport LightIcon from '@mui/icons-material/WbSunnyRounded';\nimport DarkIcon from '@mui/icons-material/Brightness2Rounded';\nimport { createTheme } from '@mui/material/styles';\n\nimport {\n createThemeProvider,\n createThemeProviderForThemeName,\n createThemeProviderForThemeConfig,\n} from './components/ThemeProvider';\nimport * as backstage from './backstage';\nimport * as rhdh from './rhdh';\n\nexport const getAllThemes = (): AppTheme[] => {\n return [\n {\n id: 'light',\n title: 'RHDH Light (latest)',\n variant: 'light',\n icon: <LightIcon />,\n Provider: createThemeProviderForThemeName('light'),\n },\n {\n id: 'dark',\n title: 'RHDH Dark (latest)',\n variant: 'dark',\n icon: <DarkIcon />,\n Provider: createThemeProviderForThemeName('dark'),\n },\n {\n id: 'light-customized',\n title: 'RHDH Light (customized)',\n variant: 'light',\n icon: <LightIcon />,\n Provider: createThemeProviderForThemeConfig({\n mode: 'light',\n variant: 'rhdh',\n palette: {\n primary: { main: '#ff0000' },\n secondary: { main: '#00ff00' },\n },\n }),\n },\n {\n id: 'dark-customized',\n title: 'RHDH Dark (customized)',\n variant: 'dark',\n icon: <DarkIcon />,\n Provider: createThemeProviderForThemeConfig({\n mode: 'dark',\n variant: 'rhdh',\n palette: {\n primary: { main: '#ff0000' },\n secondary: { main: '#00ff00' },\n },\n }),\n },\n {\n id: 'backstage-light',\n title: 'Backstage Light',\n variant: 'light',\n icon: <LightIcon />,\n Provider: createThemeProvider(themes.light),\n },\n {\n id: 'backstage-dark',\n title: 'Backstage Dark',\n variant: 'dark',\n icon: <DarkIcon />,\n Provider: createThemeProvider(themes.dark),\n },\n ];\n};\n\nexport const useAllThemes = (): AppTheme[] => {\n return React.useMemo(() => getAllThemes(), []);\n};\n\nexport const getThemes = (): AppTheme[] => {\n return [\n {\n id: 'light',\n title: 'Light',\n variant: 'light',\n icon: <LightIcon />,\n Provider: createThemeProviderForThemeName('light'),\n },\n {\n id: 'dark',\n title: 'Dark',\n variant: 'dark',\n icon: <DarkIcon />,\n Provider: createThemeProviderForThemeName('dark'),\n },\n ];\n};\n\nexport const useThemes = (): AppTheme[] => {\n return React.useMemo(() => getThemes(), []);\n};\n\nexport const useLoaderTheme = () => {\n return React.useMemo(() => {\n const latestTheme = localStorage.getItem('theme');\n const mode = latestTheme?.includes('dark') ? 'dark' : 'light';\n const variant = latestTheme?.includes('backstage') ? 'backstage' : 'rhdh';\n const themeOptions =\n variant === 'backstage'\n ? backstage.getDefaultThemeConfig(mode)\n : rhdh.getDefaultThemeConfig(mode);\n return createTheme(themeOptions);\n }, []);\n};\n"],"names":["backstage.getDefaultThemeConfig","rhdh.getDefaultThemeConfig"],"mappings":";;;;;;;;;AAgCO,MAAM,eAAe,MAAkB;AAC5C,EAAO,OAAA;AAAA,IACL;AAAA,MACE,EAAI,EAAA,OAAA;AAAA,MACJ,KAAO,EAAA,qBAAA;AAAA,MACP,OAAS,EAAA,OAAA;AAAA,MACT,IAAA,sCAAO,SAAU,EAAA,IAAA,CAAA;AAAA,MACjB,QAAA,EAAU,gCAAgC,OAAO;AAAA,KACnD;AAAA,IACA;AAAA,MACE,EAAI,EAAA,MAAA;AAAA,MACJ,KAAO,EAAA,oBAAA;AAAA,MACP,OAAS,EAAA,MAAA;AAAA,MACT,IAAA,sCAAO,QAAS,EAAA,IAAA,CAAA;AA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
-
{"version":3,"file":"typography.esm.js","sources":["../src/typography.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"typography.esm.js","sources":["../src/typography.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { BackstageTypography } from '@backstage/theme';\n\nimport { redHatFonts } from './fonts';\n\n// Font sized based on https://www.patternfly.org/design-foundations/typography\nexport const typography: BackstageTypography = {\n htmlFontSize: 16,\n fontFamily: redHatFonts.text,\n h1: {\n fontFamily: redHatFonts.heading,\n fontSize: 36,\n fontWeight: 400,\n marginBottom: 10,\n },\n h2: {\n fontFamily: redHatFonts.heading,\n fontSize: 28,\n fontWeight: 400,\n marginBottom: 8,\n },\n h3: {\n fontFamily: redHatFonts.heading,\n fontSize: 24,\n fontWeight: 400,\n marginBottom: 6,\n },\n h4: {\n fontFamily: redHatFonts.heading,\n fontSize: 20,\n fontWeight: 400,\n marginBottom: 6,\n },\n h5: {\n fontFamily: redHatFonts.heading,\n fontSize: 18,\n fontWeight: 500,\n marginBottom: 4,\n },\n h6: {\n fontFamily: redHatFonts.heading,\n fontSize: 16,\n fontWeight: 500,\n marginBottom: 2,\n },\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,UAAkC,GAAA;AAAA,EAC7C,YAAc,EAAA,EAAA;AAAA,EACd,YAAY,WAAY,CAAA,IAAA;AAAA,EACxB,EAAI,EAAA;AAAA,IACF,YAAY,WAAY,CAAA,OAAA;AAAA,IACxB,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,GAAA;AAAA,IACZ,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,EAAI,EAAA;AAAA,IACF,YAAY,WAAY,CAAA,OAAA;AAAA,IACxB,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,GAAA;AAAA,IACZ,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,EAAI,EAAA;AAAA,IACF,YAAY,WAAY,CAAA,OAAA;AAAA,IACxB,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,GAAA;AAAA,IACZ,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,EAAI,EAAA;AAAA,IACF,YAAY,WAAY,CAAA,OAAA;AAAA,IACxB,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,GAAA;AAAA,IACZ,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,EAAI,EAAA;AAAA,IACF,YAAY,WAAY,CAAA,OAAA;AAAA,IACxB,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,GAAA;AAAA,IACZ,YAAc,EAAA;AAAA,GAChB;AAAA,EACA,EAAI,EAAA;AAAA,IACF,YAAY,WAAY,CAAA,OAAA;AAAA,IACxB,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA,GAAA;AAAA,IACZ,YAAc,EAAA;AAAA;AAElB;;;;"}
|
|
@@ -68,6 +68,12 @@ const createComponents = (themeConfig) => {
|
|
|
68
68
|
height: 0
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
+
rounded: {
|
|
72
|
+
"& > :last-child": {
|
|
73
|
+
borderBottomLeftRadius: 4,
|
|
74
|
+
borderBottomRightRadius: 4
|
|
75
|
+
}
|
|
76
|
+
},
|
|
71
77
|
elevation0: noElevationStyle
|
|
72
78
|
}
|
|
73
79
|
};
|
|
@@ -90,6 +96,17 @@ const createComponents = (themeConfig) => {
|
|
|
90
96
|
components.MuiPaper.styleOverrides[elevation] = elevationStyle;
|
|
91
97
|
});
|
|
92
98
|
}
|
|
99
|
+
if (options.appBar !== "mui") {
|
|
100
|
+
components.MuiAppBar = {
|
|
101
|
+
styleOverrides: {
|
|
102
|
+
root: {
|
|
103
|
+
backgroundColor: general.appBarBackgroundColor,
|
|
104
|
+
backgroundImage: general.appBarBackgroundImage,
|
|
105
|
+
outline: "none"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
93
110
|
if (options.buttons !== "mui") {
|
|
94
111
|
components.MuiButton = {
|
|
95
112
|
defaultProps: {
|
|
@@ -98,10 +115,10 @@ const createComponents = (themeConfig) => {
|
|
|
98
115
|
styleOverrides: {
|
|
99
116
|
root: {
|
|
100
117
|
textTransform: "none",
|
|
101
|
-
border: "0",
|
|
102
118
|
borderRadius: "3px"
|
|
103
119
|
},
|
|
104
120
|
contained: {
|
|
121
|
+
border: "0",
|
|
105
122
|
boxShadow: "none",
|
|
106
123
|
"&:hover": {
|
|
107
124
|
border: "0",
|
|
@@ -136,6 +153,11 @@ const createComponents = (themeConfig) => {
|
|
|
136
153
|
"&:hover": {
|
|
137
154
|
backgroundColor: "transparent",
|
|
138
155
|
border: `1px solid`
|
|
156
|
+
},
|
|
157
|
+
"&:disabled": {
|
|
158
|
+
color: general.disabled,
|
|
159
|
+
backgroudColor: general.disabledBackground,
|
|
160
|
+
border: `1px solid ${general.disabledBackground}`
|
|
139
161
|
}
|
|
140
162
|
},
|
|
141
163
|
outlinedPrimary: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createComponents.esm.js","sources":["../../src/utils/createComponents.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n type UnifiedThemeOptions,\n defaultComponentThemes as backstageComponents,\n} from '@backstage/theme';\nimport { type CSSObject } from '@mui/material/styles';\n\nimport { ThemeConfig, ThemeConfigOptions, RHDHThemePalette } from '../types';\nimport { redHatFontFaces, redHatFonts } from '../fonts';\n\nexport type Component = {\n defaultProps?: unknown;\n styleOverrides?: unknown;\n variants?: unknown;\n};\n\nexport type Components = UnifiedThemeOptions['components'] & {\n BackstageHeaderTabs?: Component;\n BackstageSidebar?: Component;\n BackstageSidebarItem?: Component;\n BackstagePage?: Component;\n BackstageContent?: Component;\n BackstageContentHeader?: Component;\n BackstageHeader?: Component;\n BackstageItemCardHeader?: Component;\n BackstageTableToolbar?: Component;\n CatalogReactUserListPicker?: Component;\n PrivateTabIndicator?: Component;\n};\n\nexport const createComponents = (themeConfig: ThemeConfig): Components => {\n // Short hands to ensure that the code doesn't break if one of the properties is not defined.\n\n const options = themeConfig.options ?? ({} as ThemeConfigOptions);\n const disableRipple = options?.rippleEffect !== 'on'; // by default ripple effect is disabled\n\n const palette = themeConfig.palette ?? {};\n\n const general = palette.rhdh?.general || ({} as RHDHThemePalette['general']);\n const rhdhPrimary =\n palette.rhdh?.primary || ({} as RHDHThemePalette['primary']);\n const rhdhSecondary =\n palette.rhdh?.secondary || ({} as RHDHThemePalette['secondary']);\n\n const components: Components = {};\n if (options.components === 'backstage' || options.components === 'mui') {\n return components;\n }\n\n //\n // MUI components\n //\n components.MuiCssBaseline = {\n styleOverrides: theme => {\n const backstageOverrides =\n backstageComponents!.MuiCssBaseline!.styleOverrides!;\n const backstageStyles =\n typeof backstageOverrides === 'function'\n ? (backstageOverrides(theme) as CSSObject)\n : (backstageOverrides as CSSObject);\n\n return {\n ...backstageStyles,\n '@font-face': redHatFontFaces,\n body: {\n ...(backstageStyles.body as CSSObject),\n fontFamily: redHatFonts.text,\n },\n 'h1, h2, h3, h4, h5, h6': {\n fontFamily: redHatFonts.heading,\n },\n 'pre, code': {\n fontFamily: redHatFonts.monospace,\n },\n };\n },\n };\n\n // MUI base\n if (options.buttons !== 'mui') {\n components.MuiTypography = {\n styleOverrides: {\n button: {\n textTransform: 'none',\n fontWeight: 'bold',\n },\n },\n };\n }\n\n // MUI container\n if (options.paper !== 'mui') {\n const elevationStyle = {\n boxShadow: 'none',\n outline: `1px solid ${general.paperBorderColor}`,\n '& > hr[class|=\"MuiDivider-root\"]': {\n backgroundColor: general.paperBorderColor,\n },\n };\n const noElevationStyle = {\n boxShadow: 'none',\n outline: 'none',\n };\n\n components.MuiPaper = {\n styleOverrides: {\n root: {\n // This works for all MUI v5 components, but in MUI v4\n boxShadow: 'none',\n outline: `1px solid ${general.paperBorderColor}`,\n // Required only for MUI v5 components because a gradient `backgroundImage`\n // overrides the default background.paper color otherwise.\n backgroundImage: general.paperBackgroundImage,\n // hide the first child element which is a divider with MuiDivider-root classname in MuiPaper\n '& > hr:first-child[class|=\"MuiDivider-root\"]': {\n height: 0,\n },\n },\n elevation0: noElevationStyle,\n },\n };\n components.MuiPopover = {\n styleOverrides: {\n paper: {\n // Box shadow from PatternFly 5 (--pf-v5-global--BoxShadow--sm)\n boxShadow: general.popoverBoxShadow,\n // `Popover` has no outline by default, but since we're adding it to the `Paper`\n // components, this ensures that the `Popover` doesn't has a shadow and an outline.\n outline: 0,\n },\n },\n };\n\n // Required for MUI v4, not MUI v5\n const elevations = Array.from(\n { length: 24 },\n (_, i) => `elevation${i + 1}`,\n ) as 'elevation1'[];\n elevations.forEach(elevation => {\n components.MuiPaper!.styleOverrides![elevation] = elevationStyle;\n });\n }\n\n // MUI buttons\n // Don't disableRipple for MuiButtonBase as it will affect all the buttons\n // and we need to ensure that the buttons have a right touch and focus styling.\n if (options.buttons !== 'mui') {\n components.MuiButton = {\n defaultProps: {\n disableRipple,\n },\n styleOverrides: {\n root: {\n textTransform: 'none',\n border: '0',\n borderRadius: '3px',\n },\n contained: {\n boxShadow: 'none',\n '&:hover': {\n border: '0',\n boxShadow: 'none',\n },\n '&:-webkit-any-link:focus-visible': {\n outlineOffset: '0',\n },\n },\n containedPrimary: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 1px ${rhdhPrimary.focusVisibleBorder}`,\n outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`,\n },\n '&:disabled': {\n color: general.disabled,\n backgroundColor: general.disabledBackground,\n },\n },\n containedSecondary: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 1px ${rhdhSecondary.focusVisibleBorder}`,\n outline: `${rhdhSecondary.focusVisibleBorder} solid 1px`,\n },\n '&:disabled': {\n color: general.disabled,\n backgroundColor: general.disabledBackground,\n },\n },\n outlined: {\n border: `1px solid color-mix(in srgb, currentColor 50%, transparent)`,\n '&:hover': {\n backgroundColor: 'transparent',\n border: `1px solid`,\n },\n },\n outlinedPrimary: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n outlinedSecondary: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n text: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${rhdhPrimary.main}`,\n outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`,\n },\n },\n },\n };\n components.MuiToggleButton = {\n styleOverrides: {\n root: {\n textTransform: 'none',\n },\n },\n };\n components.MuiIconButton = {\n styleOverrides: {\n root: {\n '&:disabled': {\n color: general.disabled,\n },\n },\n },\n };\n components.MuiLink = {\n styleOverrides: {\n underlineHover: {\n '&:hover': {\n textDecoration: 'none',\n },\n },\n },\n };\n }\n\n // MUI input fields\n if (options.inputs !== 'mui') {\n components.MuiInputBase = {\n styleOverrides: {\n input: {\n '&::placeholder': {\n color: general.disabled,\n opacity: 1,\n },\n },\n },\n };\n components.MuiOutlinedInput = {\n styleOverrides: {\n input: {\n '&:autofill': {\n boxShadow: `0 0 0 100px ${general.formControlBackgroundColor} inset`,\n borderRadius: 'unset',\n },\n },\n },\n };\n }\n\n if (options.inputs !== 'mui') {\n components.MuiCheckbox = {\n defaultProps: {\n color: 'primary',\n },\n };\n }\n\n // MUI accordion\n if (options.accordions !== 'mui') {\n components.MuiAccordion = {\n styleOverrides: {\n root: {\n boxShadow: 'none',\n },\n rounded: {\n '&:first-child': {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n '&:last-child': {\n borderBottomLeftRadius: '0',\n borderBottomRightRadius: '0',\n },\n },\n },\n };\n }\n\n // MUI cards\n if (options.cards !== 'mui') {\n components.MuiCard = {\n styleOverrides: {\n root: {\n display: 'flex',\n flexDirection: 'column',\n backgroundColor: general.cardBackgroundColor,\n },\n },\n };\n components.MuiCardHeader = {\n styleOverrides: {\n content: {\n '& > span > nav span': {\n textTransform: 'unset',\n letterSpacing: 'normal',\n fountweight: 'normal',\n },\n },\n title: {\n fontSize: '1.125rem',\n },\n action: {\n '& > a > span > svg': {\n fontSize: '1.125rem',\n },\n '& > a[class*=\"MuiIconButton-root\"]:hover': {\n backgroundColor: 'transparent',\n },\n },\n },\n };\n components.MuiCardContent = {\n styleOverrides: {\n root: {\n flexGrow: '1',\n backgroundColor: general.cardBackgroundColor,\n '& > div > div > h2[class*=\"MuiTypography-h2-\"]': {\n textTransform: 'unset',\n opacity: '40%',\n },\n '& > div > div > div[class*=\"MuiChip-sizeSmall\"]': {\n backgroundColor: 'transparent',\n borderRadius: '8px',\n outline: `1px solid ${general.disabled}`,\n },\n '& > div[class*=\"Mui-expanded\"]': {\n margin: 'auto',\n },\n '& > div[class*=\"MuiAccordion-root\"]:before': {\n height: 0,\n },\n // Override the default line-clamp from 10 to 2 for the Software template catalog\n '& > div[class*=\"MuiGrid-root-\"][class*=\"MuiGrid-container-\"][class*=\"MuiGrid-spacing-xs-2-\"] > div[class*=\"MuiGrid-root-\"][class*=\"MuiGrid-item-\"][class*=\"MuiGrid-grid-xs-12-\"] > div[class*=\"MuiBox-root-\"]':\n {\n '-webkit-line-clamp': '2',\n },\n },\n },\n };\n }\n\n // MUI table\n if (options.tables !== 'mui') {\n components.MuiTable = {\n styleOverrides: {\n root: {\n backgroundColor: general.tableBackgroundColor,\n },\n },\n };\n components.MuiTableRow = {\n styleOverrides: {\n root: {\n backgroundColor: general.tableBackgroundColor,\n '&:not([class*=\"MuiTableRow-footer\"]):hover': {\n backgroundColor: `${general.tableRowHover} !important`,\n },\n '& > th[class*=\"MuiTableCell-head\"]': {\n backgroundColor: general.tableBackgroundColor,\n },\n },\n },\n };\n components.MuiTableCell = {\n styleOverrides: {\n root: {\n textTransform: 'none',\n '&[class*=\"BackstageTableHeader-header\"]': {\n borderTop: 'unset',\n borderBottom: `1px solid ${general.tableBorderColor}`,\n },\n },\n // @ts-expect-error: MUI types are not up to date\n head: {\n textTransform: 'unset !important',\n color: `${general.tableColumnTitleColor} !important`,\n '& > span[class*=\"MuiTableSortLabel-active\"]': {\n color: `${rhdhPrimary.main} !important`,\n },\n '& > span > svg[class*=\"MuiTableSortLabel-icon\"]': {\n color: 'inherit !important',\n },\n },\n body: {\n color: general.tableTitleColor,\n '& > div[class*=\"MuiChip-sizeSmall\"]': {\n margin: '2px',\n },\n },\n },\n };\n components.MuiTableFooter = {\n styleOverrides: {\n root: {\n '& > tr > td': {\n borderBottom: 'none',\n },\n },\n },\n };\n }\n\n // MUI toolbar\n if (options.toolbars !== 'mui') {\n components.MuiToolbar = {\n styleOverrides: {\n regular: {\n '& > div > h2[class*=\"MuiTypography-h5\"]': {\n fontSize: '1.25rem',\n color: general.tableTitleColor,\n },\n },\n },\n };\n }\n\n // MUI dialogs\n if (options.dialogs !== 'mui') {\n components.MuiDialogContent = {\n styleOverrides: {\n root: {\n '& > div': {\n backgroundColor: general.cardBackgroundColor,\n },\n },\n },\n };\n }\n\n // MUI tabs\n if (options.tabs !== 'mui') {\n components.MuiTabs = {\n defaultProps: {\n indicatorColor: 'primary',\n },\n styleOverrides: {\n root: {\n borderBottom: `1px solid ${general.tabsBottomBorderColor}`,\n padding: '0 1.5rem',\n },\n vertical: {\n '& > div > div > button[class*=\"v5\"]': {\n alignItems: 'baseline',\n textAlign: 'left',\n },\n '& > div > div > button > span': {\n alignItems: 'baseline',\n textAlign: 'left',\n },\n borderBottom: `none`,\n borderLeft: `1px solid ${general.tabsBottomBorderColor}`,\n padding: 0,\n },\n flexContainerVertical: {\n '& > button:hover': {\n boxShadow: `2px 0 ${general.tabsBottomBorderColor} inset`,\n },\n },\n indicator: {\n left: 0,\n },\n },\n };\n components.MuiTab = {\n defaultProps: {\n disableRipple,\n },\n styleOverrides: {\n root: {\n textTransform: 'none',\n minWidth: 'initial !important',\n '&:disabled': {\n backgroundColor: general.tabsDisabledBackgroundColor,\n },\n '&:hover': {\n boxShadow: `0 -2px ${general.tabsBottomBorderColor} inset`,\n },\n },\n },\n };\n }\n\n //\n // Backstage\n //\n if (options.tabs !== 'mui') {\n components.BackstageHeaderTabs = {\n styleOverrides: {\n tabsWrapper: {\n paddingLeft: '0',\n backgroundColor: general.mainSectionBackgroundColor,\n },\n defaultTab: {\n textTransform: 'none',\n fontSize: '1rem',\n fontWeight: '500',\n color: general.disabled,\n padding: '0.5rem 1rem',\n '&:hover': {\n boxShadow: `0 -3px ${general.tabsBottomBorderColor} inset`,\n },\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: 'unset',\n },\n '&:not(.Mui-selected):hover': {\n color: general.disabled,\n },\n },\n },\n };\n }\n\n if (options.sidebars !== 'mui') {\n components.BackstageSidebar = {\n styleOverrides: {\n drawer: {\n backgroundColor:\n general.sidebarBackgroundColor ?? general.sideBarBackgroundColor,\n '& a[class*=\"BackstageSidebarItem-selected-\"]': {\n backgroundColor: general.sidebarItemSelectedBackgroundColor,\n },\n },\n },\n };\n components.BackstageSidebarItem = {\n styleOverrides: {\n label: {\n '&[class*=\"MuiTypography-subtitle2\"]': {\n fontWeight: '500',\n },\n },\n },\n };\n }\n\n if (options.pages !== 'mui') {\n components.BackstagePage = {\n styleOverrides: {\n root: {\n backgroundColor: general.mainSectionBackgroundColor,\n },\n },\n };\n components.BackstageContent = {\n styleOverrides: {\n root: {\n backgroundColor: general.mainSectionBackgroundColor,\n },\n },\n };\n components.BackstageContentHeader = {\n styleOverrides: {\n leftItemsBox: {\n '& > h2[class*=\"BackstageContentHeader-title-\"][class*=\"MuiTypography-h4-\"]':\n {\n fontWeight: 'bold',\n fontSize: '1.75rem',\n },\n },\n },\n };\n }\n\n if (options.headers !== 'mui') {\n components.BackstageHeader = {\n styleOverrides: {\n header: {\n boxShadow: 'none',\n borderBottom: `1px solid ${general.headerBottomBorderColor}`,\n },\n title: {\n fontWeight: 'bold',\n '&[class*=\"MuiTypography-h1-\"]': {\n fontWeight: 'bold',\n fontSize: '2rem',\n },\n },\n },\n };\n components.BackstageItemCardHeader = {\n styleOverrides: {\n root: {\n // This is required to increase the css specificity, to OVERRIDE the styles from\n // BackstageItemCardHeader (https://github.com/backstage/backstage/blob/master/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx)\n // These are applied with a CSS class as well.\n\n // This variant is used when running the Storybook locally (dev mode) and in Backstage/RHDH!\n '&[class*=\"MuiBox-root-\"]': {\n color: palette.rhdh?.cards?.headerTextColor,\n backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,\n backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,\n borderBottom: `1px solid ${general.cardBorderColor}`,\n },\n // This variant is used when building a static Storybook (`storybook:build`)\n '&[class~=\"MuiBox-root\"]': {\n color: palette.rhdh?.cards?.headerTextColor,\n backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,\n backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,\n borderBottom: `1px solid ${general.cardBorderColor}`,\n },\n '& > h3[class*=\"MuiTypography-subtitle2-\"] > div > div:first-child': {\n textTransform: 'capitalize',\n },\n },\n },\n };\n }\n\n if (options.toolbars !== 'mui') {\n components.BackstageTableToolbar = {\n styleOverrides: {\n root: {\n '& h2': {\n fontWeight: 'bold',\n },\n },\n title: {\n '& > h2': {\n fontWeight: 'bold',\n },\n },\n },\n };\n }\n\n //\n // Others\n //\n components.CatalogReactUserListPicker = {\n styleOverrides: {\n root: {\n borderRadius: '4px',\n },\n title: {\n textTransform: 'none',\n },\n },\n };\n\n if (options.tabs !== 'mui') {\n components.PrivateTabIndicator = {\n styleOverrides: {\n root: {\n height: '3px',\n },\n vertical: {\n width: '3px',\n },\n },\n };\n }\n\n return components;\n};\n"],"names":["backstageComponents"],"mappings":";;;AA4Ca,MAAA,gBAAA,GAAmB,CAAC,WAAyC,KAAA;AAGxE,EAAM,MAAA,OAAA,GAAU,WAAY,CAAA,OAAA,IAAY,EAAC;AACzC,EAAM,MAAA,aAAA,GAAgB,SAAS,YAAiB,KAAA,IAAA;AAEhD,EAAM,MAAA,OAAA,GAAU,WAAY,CAAA,OAAA,IAAW,EAAC;AAExC,EAAA,MAAM,OAAU,GAAA,OAAA,CAAQ,IAAM,EAAA,OAAA,IAAY,EAAC;AAC3C,EAAA,MAAM,WACJ,GAAA,OAAA,CAAQ,IAAM,EAAA,OAAA,IAAY,EAAC;AAC7B,EAAA,MAAM,aACJ,GAAA,OAAA,CAAQ,IAAM,EAAA,SAAA,IAAc,EAAC;AAE/B,EAAA,MAAM,aAAyB,EAAC;AAChC,EAAA,IAAI,OAAQ,CAAA,UAAA,KAAe,WAAe,IAAA,OAAA,CAAQ,eAAe,KAAO,EAAA;AACtE,IAAO,OAAA,UAAA;AAAA;AAMT,EAAA,UAAA,CAAW,cAAiB,GAAA;AAAA,IAC1B,gBAAgB,CAAS,KAAA,KAAA;AACvB,MAAM,MAAA,kBAAA,GACJA,uBAAqB,cAAgB,CAAA,cAAA;AACvC,MAAA,MAAM,kBACJ,OAAO,kBAAA,KAAuB,UACzB,GAAA,kBAAA,CAAmB,KAAK,CACxB,GAAA,kBAAA;AAEP,MAAO,OAAA;AAAA,QACL,GAAG,eAAA;AAAA,QACH,YAAc,EAAA,eAAA;AAAA,QACd,IAAM,EAAA;AAAA,UACJ,GAAI,eAAgB,CAAA,IAAA;AAAA,UACpB,YAAY,WAAY,CAAA;AAAA,SAC1B;AAAA,QACA,wBAA0B,EAAA;AAAA,UACxB,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AA,UACL,QAAU,EAAA;AAAA,YACR,UAAY,EAAA;AAAA;AACd;AACF;AACF,KACF;AAAA;AAMF,EAAA,UAAA,CAAW,0BAA6B,GAAA;AAAA,IACtC,cAAgB,EAAA;AAAA,MACd,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,KAAO,EAAA;AAAA,QACL,aAAe,EAAA;AAAA;AACjB;AACF,GACF;AAEA,EAAI,IAAA,OAAA,CAAQ,SAAS,KAAO,EAAA;AAC1B,IAAA,UAAA,CAAW,mBAAsB,GAAA;AAAA,MAC/B,cAAgB,EAAA;AAAA,QACd,IAAM,EAAA;AAAA,UACJ,MAAQ,EAAA;AAAA,SACV;AAAA,QACA,QAAU,EAAA;AAAA,UACR,KAAO,EAAA;AAAA;AACT;AACF,KACF;AAAA;AAGF,EAAO,OAAA,UAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"createComponents.esm.js","sources":["../../src/utils/createComponents.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 {\n type UnifiedThemeOptions,\n defaultComponentThemes as backstageComponents,\n} from '@backstage/theme';\nimport { type CSSObject } from '@mui/material/styles';\n\nimport { ThemeConfig, ThemeConfigOptions, RHDHThemePalette } from '../types';\nimport { redHatFontFaces, redHatFonts } from '../fonts';\n\nexport type Component = {\n defaultProps?: unknown;\n styleOverrides?: unknown;\n variants?: unknown;\n};\n\nexport type Components = UnifiedThemeOptions['components'] & {\n BackstageHeaderTabs?: Component;\n BackstageSidebar?: Component;\n BackstageSidebarItem?: Component;\n BackstagePage?: Component;\n BackstageContent?: Component;\n BackstageContentHeader?: Component;\n BackstageHeader?: Component;\n BackstageItemCardHeader?: Component;\n BackstageTableToolbar?: Component;\n CatalogReactUserListPicker?: Component;\n PrivateTabIndicator?: Component;\n};\n\nexport const createComponents = (themeConfig: ThemeConfig): Components => {\n // Short hands to ensure that the code doesn't break if one of the properties is not defined.\n\n const options = themeConfig.options ?? ({} as ThemeConfigOptions);\n const disableRipple = options?.rippleEffect !== 'on'; // by default ripple effect is disabled\n\n const palette = themeConfig.palette ?? {};\n\n const general = palette.rhdh?.general || ({} as RHDHThemePalette['general']);\n const rhdhPrimary =\n palette.rhdh?.primary || ({} as RHDHThemePalette['primary']);\n const rhdhSecondary =\n palette.rhdh?.secondary || ({} as RHDHThemePalette['secondary']);\n\n const components: Components = {};\n if (options.components === 'backstage' || options.components === 'mui') {\n return components;\n }\n\n //\n // MUI components\n //\n components.MuiCssBaseline = {\n styleOverrides: theme => {\n const backstageOverrides =\n backstageComponents!.MuiCssBaseline!.styleOverrides!;\n const backstageStyles =\n typeof backstageOverrides === 'function'\n ? (backstageOverrides(theme) as CSSObject)\n : (backstageOverrides as CSSObject);\n\n return {\n ...backstageStyles,\n '@font-face': redHatFontFaces,\n body: {\n ...(backstageStyles.body as CSSObject),\n fontFamily: redHatFonts.text,\n },\n 'h1, h2, h3, h4, h5, h6': {\n fontFamily: redHatFonts.heading,\n },\n 'pre, code': {\n fontFamily: redHatFonts.monospace,\n },\n };\n },\n };\n\n // MUI base\n if (options.buttons !== 'mui') {\n components.MuiTypography = {\n styleOverrides: {\n button: {\n textTransform: 'none',\n fontWeight: 'bold',\n },\n },\n };\n }\n\n // MUI container\n if (options.paper !== 'mui') {\n const elevationStyle = {\n boxShadow: 'none',\n outline: `1px solid ${general.paperBorderColor}`,\n '& > hr[class|=\"MuiDivider-root\"]': {\n backgroundColor: general.paperBorderColor,\n },\n };\n const noElevationStyle = {\n boxShadow: 'none',\n outline: 'none',\n };\n\n components.MuiPaper = {\n styleOverrides: {\n root: {\n // This works for all MUI v5 components, but in MUI v4\n boxShadow: 'none',\n outline: `1px solid ${general.paperBorderColor}`,\n // Required only for MUI v5 components because a gradient `backgroundImage`\n // overrides the default background.paper color otherwise.\n backgroundImage: general.paperBackgroundImage,\n // hide the first child element which is a divider with MuiDivider-root classname in MuiPaper\n '& > hr:first-child[class|=\"MuiDivider-root\"]': {\n height: 0,\n },\n },\n rounded: {\n '& > :last-child': {\n borderBottomLeftRadius: 4,\n borderBottomRightRadius: 4,\n },\n },\n elevation0: noElevationStyle,\n },\n };\n components.MuiPopover = {\n styleOverrides: {\n paper: {\n // Box shadow from PatternFly 5 (--pf-v5-global--BoxShadow--sm)\n boxShadow: general.popoverBoxShadow,\n // `Popover` has no outline by default, but since we're adding it to the `Paper`\n // components, this ensures that the `Popover` doesn't has a shadow and an outline.\n outline: 0,\n },\n },\n };\n\n // Required for MUI v4, not MUI v5\n const elevations = Array.from(\n { length: 24 },\n (_, i) => `elevation${i + 1}`,\n ) as 'elevation1'[];\n elevations.forEach(elevation => {\n components.MuiPaper!.styleOverrides![elevation] = elevationStyle;\n });\n }\n\n // MUI AppBar\n if (options.appBar !== 'mui') {\n components.MuiAppBar = {\n styleOverrides: {\n root: {\n backgroundColor: general.appBarBackgroundColor,\n backgroundImage: general.appBarBackgroundImage,\n outline: 'none',\n },\n },\n };\n }\n\n // MUI buttons\n // Don't disableRipple for MuiButtonBase as it will affect all the buttons\n // and we need to ensure that the buttons have a right touch and focus styling.\n if (options.buttons !== 'mui') {\n components.MuiButton = {\n defaultProps: {\n disableRipple,\n },\n styleOverrides: {\n root: {\n textTransform: 'none',\n borderRadius: '3px',\n },\n contained: {\n border: '0',\n boxShadow: 'none',\n '&:hover': {\n border: '0',\n boxShadow: 'none',\n },\n '&:-webkit-any-link:focus-visible': {\n outlineOffset: '0',\n },\n },\n containedPrimary: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 1px ${rhdhPrimary.focusVisibleBorder}`,\n outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`,\n },\n '&:disabled': {\n color: general.disabled,\n backgroundColor: general.disabledBackground,\n },\n },\n containedSecondary: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 1px ${rhdhSecondary.focusVisibleBorder}`,\n outline: `${rhdhSecondary.focusVisibleBorder} solid 1px`,\n },\n '&:disabled': {\n color: general.disabled,\n backgroundColor: general.disabledBackground,\n },\n },\n outlined: {\n border: `1px solid color-mix(in srgb, currentColor 50%, transparent)`,\n '&:hover': {\n backgroundColor: 'transparent',\n border: `1px solid`,\n },\n '&:disabled': {\n color: general.disabled,\n backgroudColor: general.disabledBackground,\n border: `1px solid ${general.disabledBackground}`,\n },\n },\n outlinedPrimary: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n outlinedSecondary: {\n '&:hover': {\n backgroundColor: 'transparent',\n },\n },\n text: {\n '&:focus-visible': {\n boxShadow: `inset 0 0 0 2px ${rhdhPrimary.main}`,\n outline: `${rhdhPrimary.focusVisibleBorder} solid 1px`,\n },\n },\n },\n };\n components.MuiToggleButton = {\n styleOverrides: {\n root: {\n textTransform: 'none',\n },\n },\n };\n components.MuiIconButton = {\n styleOverrides: {\n root: {\n '&:disabled': {\n color: general.disabled,\n },\n },\n },\n };\n components.MuiLink = {\n styleOverrides: {\n underlineHover: {\n '&:hover': {\n textDecoration: 'none',\n },\n },\n },\n };\n }\n\n // MUI input fields\n if (options.inputs !== 'mui') {\n components.MuiInputBase = {\n styleOverrides: {\n input: {\n '&::placeholder': {\n color: general.disabled,\n opacity: 1,\n },\n },\n },\n };\n components.MuiOutlinedInput = {\n styleOverrides: {\n input: {\n '&:autofill': {\n boxShadow: `0 0 0 100px ${general.formControlBackgroundColor} inset`,\n borderRadius: 'unset',\n },\n },\n },\n };\n }\n\n if (options.inputs !== 'mui') {\n components.MuiCheckbox = {\n defaultProps: {\n color: 'primary',\n },\n };\n }\n\n // MUI accordion\n if (options.accordions !== 'mui') {\n components.MuiAccordion = {\n styleOverrides: {\n root: {\n boxShadow: 'none',\n },\n rounded: {\n '&:first-child': {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n '&:last-child': {\n borderBottomLeftRadius: '0',\n borderBottomRightRadius: '0',\n },\n },\n },\n };\n }\n\n // MUI cards\n if (options.cards !== 'mui') {\n components.MuiCard = {\n styleOverrides: {\n root: {\n display: 'flex',\n flexDirection: 'column',\n backgroundColor: general.cardBackgroundColor,\n },\n },\n };\n components.MuiCardHeader = {\n styleOverrides: {\n content: {\n '& > span > nav span': {\n textTransform: 'unset',\n letterSpacing: 'normal',\n fountweight: 'normal',\n },\n },\n title: {\n fontSize: '1.125rem',\n },\n action: {\n '& > a > span > svg': {\n fontSize: '1.125rem',\n },\n '& > a[class*=\"MuiIconButton-root\"]:hover': {\n backgroundColor: 'transparent',\n },\n },\n },\n };\n components.MuiCardContent = {\n styleOverrides: {\n root: {\n flexGrow: '1',\n backgroundColor: general.cardBackgroundColor,\n '& > div > div > h2[class*=\"MuiTypography-h2-\"]': {\n textTransform: 'unset',\n opacity: '40%',\n },\n '& > div > div > div[class*=\"MuiChip-sizeSmall\"]': {\n backgroundColor: 'transparent',\n borderRadius: '8px',\n outline: `1px solid ${general.disabled}`,\n },\n '& > div[class*=\"Mui-expanded\"]': {\n margin: 'auto',\n },\n '& > div[class*=\"MuiAccordion-root\"]:before': {\n height: 0,\n },\n // Override the default line-clamp from 10 to 2 for the Software template catalog\n '& > div[class*=\"MuiGrid-root-\"][class*=\"MuiGrid-container-\"][class*=\"MuiGrid-spacing-xs-2-\"] > div[class*=\"MuiGrid-root-\"][class*=\"MuiGrid-item-\"][class*=\"MuiGrid-grid-xs-12-\"] > div[class*=\"MuiBox-root-\"]':\n {\n '-webkit-line-clamp': '2',\n },\n },\n },\n };\n }\n\n // MUI table\n if (options.tables !== 'mui') {\n components.MuiTable = {\n styleOverrides: {\n root: {\n backgroundColor: general.tableBackgroundColor,\n },\n },\n };\n components.MuiTableRow = {\n styleOverrides: {\n root: {\n backgroundColor: general.tableBackgroundColor,\n '&:not([class*=\"MuiTableRow-footer\"]):hover': {\n backgroundColor: `${general.tableRowHover} !important`,\n },\n '& > th[class*=\"MuiTableCell-head\"]': {\n backgroundColor: general.tableBackgroundColor,\n },\n },\n },\n };\n components.MuiTableCell = {\n styleOverrides: {\n root: {\n textTransform: 'none',\n '&[class*=\"BackstageTableHeader-header\"]': {\n borderTop: 'unset',\n borderBottom: `1px solid ${general.tableBorderColor}`,\n },\n },\n // @ts-expect-error: MUI types are not up to date\n head: {\n textTransform: 'unset !important',\n color: `${general.tableColumnTitleColor} !important`,\n '& > span[class*=\"MuiTableSortLabel-active\"]': {\n color: `${rhdhPrimary.main} !important`,\n },\n '& > span > svg[class*=\"MuiTableSortLabel-icon\"]': {\n color: 'inherit !important',\n },\n },\n body: {\n color: general.tableTitleColor,\n '& > div[class*=\"MuiChip-sizeSmall\"]': {\n margin: '2px',\n },\n },\n },\n };\n components.MuiTableFooter = {\n styleOverrides: {\n root: {\n '& > tr > td': {\n borderBottom: 'none',\n },\n },\n },\n };\n }\n\n // MUI toolbar\n if (options.toolbars !== 'mui') {\n components.MuiToolbar = {\n styleOverrides: {\n regular: {\n '& > div > h2[class*=\"MuiTypography-h5\"]': {\n fontSize: '1.25rem',\n color: general.tableTitleColor,\n },\n },\n },\n };\n }\n\n // MUI dialogs\n if (options.dialogs !== 'mui') {\n components.MuiDialogContent = {\n styleOverrides: {\n root: {\n '& > div': {\n backgroundColor: general.cardBackgroundColor,\n },\n },\n },\n };\n }\n\n // MUI tabs\n if (options.tabs !== 'mui') {\n components.MuiTabs = {\n defaultProps: {\n indicatorColor: 'primary',\n },\n styleOverrides: {\n root: {\n borderBottom: `1px solid ${general.tabsBottomBorderColor}`,\n padding: '0 1.5rem',\n },\n vertical: {\n '& > div > div > button[class*=\"v5\"]': {\n alignItems: 'baseline',\n textAlign: 'left',\n },\n '& > div > div > button > span': {\n alignItems: 'baseline',\n textAlign: 'left',\n },\n borderBottom: `none`,\n borderLeft: `1px solid ${general.tabsBottomBorderColor}`,\n padding: 0,\n },\n flexContainerVertical: {\n '& > button:hover': {\n boxShadow: `2px 0 ${general.tabsBottomBorderColor} inset`,\n },\n },\n indicator: {\n left: 0,\n },\n },\n };\n components.MuiTab = {\n defaultProps: {\n disableRipple,\n },\n styleOverrides: {\n root: {\n textTransform: 'none',\n minWidth: 'initial !important',\n '&:disabled': {\n backgroundColor: general.tabsDisabledBackgroundColor,\n },\n '&:hover': {\n boxShadow: `0 -2px ${general.tabsBottomBorderColor} inset`,\n },\n },\n },\n };\n }\n\n //\n // Backstage\n //\n if (options.tabs !== 'mui') {\n components.BackstageHeaderTabs = {\n styleOverrides: {\n tabsWrapper: {\n paddingLeft: '0',\n backgroundColor: general.mainSectionBackgroundColor,\n },\n defaultTab: {\n textTransform: 'none',\n fontSize: '1rem',\n fontWeight: '500',\n color: general.disabled,\n padding: '0.5rem 1rem',\n '&:hover': {\n boxShadow: `0 -3px ${general.tabsBottomBorderColor} inset`,\n },\n },\n tabRoot: {\n '&:hover': {\n backgroundColor: 'unset',\n },\n '&:not(.Mui-selected):hover': {\n color: general.disabled,\n },\n },\n },\n };\n }\n\n if (options.sidebars !== 'mui') {\n components.BackstageSidebar = {\n styleOverrides: {\n drawer: {\n backgroundColor:\n general.sidebarBackgroundColor ?? general.sideBarBackgroundColor,\n '& a[class*=\"BackstageSidebarItem-selected-\"]': {\n backgroundColor: general.sidebarItemSelectedBackgroundColor,\n },\n },\n },\n };\n components.BackstageSidebarItem = {\n styleOverrides: {\n label: {\n '&[class*=\"MuiTypography-subtitle2\"]': {\n fontWeight: '500',\n },\n },\n },\n };\n }\n\n if (options.pages !== 'mui') {\n components.BackstagePage = {\n styleOverrides: {\n root: {\n backgroundColor: general.mainSectionBackgroundColor,\n },\n },\n };\n components.BackstageContent = {\n styleOverrides: {\n root: {\n backgroundColor: general.mainSectionBackgroundColor,\n },\n },\n };\n components.BackstageContentHeader = {\n styleOverrides: {\n leftItemsBox: {\n '& > h2[class*=\"BackstageContentHeader-title-\"][class*=\"MuiTypography-h4-\"]':\n {\n fontWeight: 'bold',\n fontSize: '1.75rem',\n },\n },\n },\n };\n }\n\n if (options.headers !== 'mui') {\n components.BackstageHeader = {\n styleOverrides: {\n header: {\n boxShadow: 'none',\n borderBottom: `1px solid ${general.headerBottomBorderColor}`,\n },\n title: {\n fontWeight: 'bold',\n '&[class*=\"MuiTypography-h1-\"]': {\n fontWeight: 'bold',\n fontSize: '2rem',\n },\n },\n },\n };\n components.BackstageItemCardHeader = {\n styleOverrides: {\n root: {\n // This is required to increase the css specificity, to OVERRIDE the styles from\n // BackstageItemCardHeader (https://github.com/backstage/backstage/blob/master/packages/core-components/src/layout/ItemCard/ItemCardHeader.tsx)\n // These are applied with a CSS class as well.\n\n // This variant is used when running the Storybook locally (dev mode) and in Backstage/RHDH!\n '&[class*=\"MuiBox-root-\"]': {\n color: palette.rhdh?.cards?.headerTextColor,\n backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,\n backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,\n borderBottom: `1px solid ${general.cardBorderColor}`,\n },\n // This variant is used when building a static Storybook (`storybook:build`)\n '&[class~=\"MuiBox-root\"]': {\n color: palette.rhdh?.cards?.headerTextColor,\n backgroundColor: palette.rhdh?.cards?.headerBackgroundColor,\n backgroundImage: palette.rhdh?.cards?.headerBackgroundImage,\n borderBottom: `1px solid ${general.cardBorderColor}`,\n },\n '& > h3[class*=\"MuiTypography-subtitle2-\"] > div > div:first-child': {\n textTransform: 'capitalize',\n },\n },\n },\n };\n }\n\n if (options.toolbars !== 'mui') {\n components.BackstageTableToolbar = {\n styleOverrides: {\n root: {\n '& h2': {\n fontWeight: 'bold',\n },\n },\n title: {\n '& > h2': {\n fontWeight: 'bold',\n },\n },\n },\n };\n }\n\n //\n // Others\n //\n components.CatalogReactUserListPicker = {\n styleOverrides: {\n root: {\n borderRadius: '4px',\n },\n title: {\n textTransform: 'none',\n },\n },\n };\n\n if (options.tabs !== 'mui') {\n components.PrivateTabIndicator = {\n styleOverrides: {\n root: {\n height: '3px',\n },\n vertical: {\n width: '3px',\n },\n },\n };\n }\n\n return components;\n};\n"],"names":["backstageComponents"],"mappings":";;;AA6Ca,MAAA,gBAAA,GAAmB,CAAC,WAAyC,KAAA;AAGxE,EAAM,MAAA,OAAA,GAAU,WAAY,CAAA,OAAA,IAAY,EAAC;AACzC,EAAM,MAAA,aAAA,GAAgB,SAAS,YAAiB,KAAA,IAAA;AAEhD,EAAM,MAAA,OAAA,GAAU,WAAY,CAAA,OAAA,IAAW,EAAC;AAExC,EAAA,MAAM,OAAU,GAAA,OAAA,CAAQ,IAAM,EAAA,OAAA,IAAY,EAAC;AAC3C,EAAA,MAAM,WACJ,GAAA,OAAA,CAAQ,IAAM,EAAA,OAAA,IAAY,EAAC;AAC7B,EAAA,MAAM,aACJ,GAAA,OAAA,CAAQ,IAAM,EAAA,SAAA,IAAc,EAAC;AAE/B,EAAA,MAAM,aAAyB,EAAC;AAChC,EAAA,IAAI,OAAQ,CAAA,UAAA,KAAe,WAAe,IAAA,OAAA,CAAQ,eAAe,KAAO,EAAA;AACtE,IAAO,OAAA,UAAA;AAAA;AAMT,EAAA,UAAA,CAAW,cAAiB,GAAA;AAAA,IAC1B,gBAAgB,CAAS,KAAA,KAAA;AACvB,MAAM,MAAA,kBAAA,GACJA,uBAAqB,cAAgB,CAAA,cAAA;AACvC,MAAA,MAAM,kBACJ,OAAO,kBAAA,KAAuB,UACzB,GAAA,kBAAA,CAAmB,KAAK,CACxB,GAAA,kBAAA;AAEP,MAAO,OAAA;AAAA,QACL,GAAG,eAAA;AAAA,QACH,YAAc,EAAA,eAAA;AAAA,QACd,IAAM,EAAA;AAAA,UACJ,GAAI,eAAgB,CAAA,IAAA;AAAA,UACpB,YAAY,WAAY,CAAA;AAAA,SAC1B;AAAA,QACA,wBAA0B,EAAA;AAAA,UACxB,YAAY,WAAY,CAAA;AAAA,SAC1B;AAAA,Q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A,eAAA;AAAA,YAC5B,eAAA,EAAiB,OAAQ,CAAA,IAAA,EAAM,KAAO,EAAA,qBAAA;AAAA,YACtC,eAAA,EAAiB,OAAQ,CAAA,IAAA,EAAM,KAAO,EAAA,qBAAA;AAAA,YACtC,YAAA,EAAc,CAAa,UAAA,EAAA,OAAA,CAAQ,eAAe,CAAA;AAAA,WACpD;AAAA,UACA,mEAAqE,EAAA;AAAA,YACnE,aAAe,EAAA;AAAA;AACjB;AACF;AACF,KACF;AAAA;AAGF,EAAI,IAAA,OAAA,CAAQ,aAAa,KAAO,EAAA;AAC9B,IAAA,UAAA,CAAW,qBAAwB,GAAA;AAAA,MACjC,cAAgB,EAAA;AAAA,QACd,IAAM,EAAA;AAAA,UACJ,MAAQ,EAAA;AAAA,YACN,UAAY,EAAA;AAAA;AACd,SACF;AAAA,QACA,KAAO,EAAA;AAAA,UACL,QAAU,EAAA;AAAA,YACR,UAAY,EAAA;AAAA;AACd;AACF;AACF,KACF;AAAA;AAMF,EAAA,UAAA,CAAW,0BAA6B,GAAA;AAAA,IACtC,cAAgB,EAAA;AAAA,MACd,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,KAAO,EAAA;AAAA,QACL,aAAe,EAAA;AAAA;AACjB;AACF,GACF;AAEA,EAAI,IAAA,OAAA,CAAQ,SAAS,KAAO,EAAA;AAC1B,IAAA,UAAA,CAAW,mBAAsB,GAAA;AAAA,MAC/B,cAAgB,EAAA;AAAA,QACd,IAAM,EAAA;AAAA,UACJ,MAAQ,EAAA;AAAA,SACV;AAAA,QACA,QAAU,EAAA;AAAA,UACR,KAAO,EAAA;AAAA;AACT;AACF,KACF;AAAA;AAGF,EAAO,OAAA,UAAA;AACT;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPageTheme.esm.js","sources":["../../src/utils/createPageTheme.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"createPageTheme.esm.js","sources":["../../src/utils/createPageTheme.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { PageTheme, genPageTheme, shapes } from '@backstage/theme';\nimport { ThemeConfigPageTheme } from '../types';\n\n/**\n * Creates a page theme from a page theme configuration (app-config.yaml).\n *\n * This allows the user to specificy a custom header with:\n *\n * * `backgroundColor` or `colors` like `'#ff0000'`, `['#ff0000']` or `['#ff0000', '#00ff00', '#0000ff']`.\n *\n * More then one color will create a gradient from left to right.\n *\n * * a `shape` like `round`, `wave`, `wave2`, or `none`.\n *\n * * or an `backgroundImage` that supports different types of images references:\n *\n * 1. CSS urls like `data:image/svg+xml,...` or `url(data:image/svg+xml,...)`\n * 2. Absolute or relative URLs starting with `http://`, `https://` or `/`\n * 3. Inline <svg>...</svg> images will be transformed to `url(data:image/svg+xml,<svg>...</svg>)`\n *\n * * `fontColor` like `'#ffffff'` or `'#000000'`\n */\nexport const createPageTheme = (\n pageThemeConfig: ThemeConfigPageTheme,\n): PageTheme => {\n let colors = pageThemeConfig.backgroundColor ?? pageThemeConfig.colors;\n if (typeof colors === 'string') {\n colors = [colors];\n } else if (!colors?.length) {\n colors = ['transparent'];\n }\n\n let shape =\n pageThemeConfig.backgroundImage ??\n shapes[pageThemeConfig.shape as string] ??\n pageThemeConfig.shape ??\n 'none';\n if (\n shape.startsWith('data:') ||\n shape.startsWith('http://') ||\n shape.startsWith('https://') ||\n shape.startsWith('/')\n ) {\n shape = `url(\"${shape}\")`;\n } else if (shape.startsWith('<svg') && shape.endsWith('>')) {\n shape = `url(\"data:image/svg+xml,${encodeURIComponent(shape)}\")`;\n }\n\n // https://github.com/backstage/backstage/blob/master/packages/theme/src/base/pageTheme.ts#L59-L87\n return genPageTheme({\n colors,\n shape,\n options: {\n fontColor: pageThemeConfig.fontColor, // default is white in genPageTheme!\n },\n });\n};\n"],"names":[],"mappings":";;AAsCa,MAAA,eAAA,GAAkB,CAC7B,eACc,KAAA;AACd,EAAI,IAAA,MAAA,GAAS,eAAgB,CAAA,eAAA,IAAmB,eAAgB,CAAA,MAAA;AAChE,EAAI,IAAA,OAAO,WAAW,QAAU,EAAA;AAC9B,IAAA,MAAA,GAAS,CAAC,MAAM,CAAA;AAAA,GAClB,MAAA,IAAW,CAAC,MAAA,EAAQ,MAAQ,EAAA;AAC1B,IAAA,MAAA,GAAS,CAAC,aAAa,CAAA;AAAA;AAGzB,EAAI,IAAA,KAAA,GACF,gBAAgB,eAChB,IAAA,MAAA,CAAO,gBAAgB,KAAe,CAAA,IACtC,gBAAgB,KAChB,IAAA,MAAA;AACF,EAAA,IACE,KAAM,CAAA,UAAA,CAAW,OAAO,CAAA,IACxB,MAAM,UAAW,CAAA,SAAS,CAC1B,IAAA,KAAA,CAAM,WAAW,UAAU,CAAA,IAC3B,KAAM,CAAA,UAAA,CAAW,GAAG,CACpB,EAAA;AACA,IAAA,KAAA,GAAQ,QAAQ,KAAK,CAAA,EAAA,CAAA;AAAA,GACvB,MAAA,IAAW,MAAM,UAAW,CAAA,MAAM,KAAK,KAAM,CAAA,QAAA,CAAS,GAAG,CAAG,EAAA;AAC1D,IAAQ,KAAA,GAAA,CAAA,wBAAA,EAA2B,kBAAmB,CAAA,KAAK,CAAC,CAAA,EAAA,CAAA;AAAA;AAI9D,EAAA,OAAO,YAAa,CAAA;AAAA,IAClB,MAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAS,EAAA;AAAA,MACP,WAAW,eAAgB,CAAA;AAAA;AAAA;AAC7B,GACD,CAAA;AACH;;;;"}
|
|
@@ -2,7 +2,7 @@ import { createPageTheme } from './createPageTheme.esm.js';
|
|
|
2
2
|
|
|
3
3
|
const createPageThemes = (themeConfig) => {
|
|
4
4
|
if (!themeConfig?.pageTheme || !Object.keys(themeConfig.pageTheme).length) {
|
|
5
|
-
return
|
|
5
|
+
return undefined;
|
|
6
6
|
}
|
|
7
7
|
const pageThemes = {};
|
|
8
8
|
for (const page in themeConfig.pageTheme) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPageThemes.esm.js","sources":["../../src/utils/createPageThemes.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"createPageThemes.esm.js","sources":["../../src/utils/createPageThemes.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { PageTheme } from '@backstage/theme';\nimport { ThemeConfig } from '../types';\nimport { createPageTheme } from './createPageTheme';\n\nexport const createPageThemes = (\n themeConfig: ThemeConfig | undefined,\n): Record<string, PageTheme> | undefined => {\n if (!themeConfig?.pageTheme || !Object.keys(themeConfig.pageTheme).length) {\n return undefined;\n }\n\n const pageThemes: Record<string, PageTheme> = {};\n\n for (const page in themeConfig.pageTheme) {\n if (Object.hasOwn(themeConfig.pageTheme, page)) {\n pageThemes[page] = createPageTheme(themeConfig.pageTheme[page]);\n }\n }\n\n return pageThemes;\n};\n"],"names":[],"mappings":";;AAoBa,MAAA,gBAAA,GAAmB,CAC9B,WAC0C,KAAA;AAC1C,EAAI,IAAA,CAAC,aAAa,SAAa,IAAA,CAAC,OAAO,IAAK,CAAA,WAAA,CAAY,SAAS,CAAA,CAAE,MAAQ,EAAA;AACzE,IAAO,OAAA,SAAA;AAAA;AAGT,EAAA,MAAM,aAAwC,EAAC;AAE/C,EAAW,KAAA,MAAA,IAAA,IAAQ,YAAY,SAAW,EAAA;AACxC,IAAA,IAAI,MAAO,CAAA,MAAA,CAAO,WAAY,CAAA,SAAA,EAAW,IAAI,CAAG,EAAA;AAC9C,MAAA,UAAA,CAAW,IAAI,CAAI,GAAA,eAAA,CAAgB,WAAY,CAAA,SAAA,CAAU,IAAI,CAAC,CAAA;AAAA;AAChE;AAGF,EAAO,OAAA,UAAA;AACT;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function isObject(objectOrValue) {
|
|
2
|
-
return objectOrValue !==
|
|
2
|
+
return objectOrValue !== undefined && objectOrValue !== null && typeof objectOrValue === "object" && !Array.isArray(objectOrValue);
|
|
3
3
|
}
|
|
4
4
|
const deepCopyObject = (objectOrValue) => {
|
|
5
5
|
if (isObject(objectOrValue)) {
|
|
@@ -34,7 +34,7 @@ const deepMergeObjects = (defaultValue, customValue) => {
|
|
|
34
34
|
}
|
|
35
35
|
return result;
|
|
36
36
|
}
|
|
37
|
-
return customValue !==
|
|
37
|
+
return customValue !== undefined ? customValue : defaultValue;
|
|
38
38
|
};
|
|
39
39
|
const mergeUnifiedThemeOptions = (defaultThemeConfig, customizedThemeConfig) => {
|
|
40
40
|
return deepMergeObjects(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTheme.esm.js","sources":["../../src/utils/mergeTheme.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"mergeTheme.esm.js","sources":["../../src/utils/mergeTheme.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 { ThemeConfig } from '../types';\n\nfunction isObject(\n objectOrValue: unknown,\n): objectOrValue is Record<string, unknown> {\n return (\n objectOrValue !== undefined &&\n objectOrValue !== null &&\n typeof objectOrValue === 'object' &&\n !Array.isArray(objectOrValue)\n );\n}\n\nconst deepCopyObject = (objectOrValue: unknown): unknown => {\n if (isObject(objectOrValue)) {\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(objectOrValue)) {\n result[key] = deepCopyObject(objectOrValue[key]);\n }\n return result;\n }\n return objectOrValue;\n};\n\nexport const deepMergeObjects = (\n defaultValue: unknown,\n customValue: unknown,\n): unknown => {\n if (isObject(defaultValue) || isObject(customValue)) {\n const result: Record<string, unknown> = {};\n if (isObject(defaultValue) && isObject(customValue)) {\n for (const key of Object.keys(defaultValue)) {\n result[key] = deepMergeObjects(defaultValue[key], customValue[key]);\n }\n for (const key of Object.keys(customValue)) {\n result[key] = deepMergeObjects(defaultValue[key], customValue[key]);\n }\n } else if (customValue === null) {\n return null;\n } else if (isObject(customValue)) {\n for (const key of Object.keys(customValue)) {\n result[key] = deepCopyObject(customValue[key]);\n }\n } else if (isObject(defaultValue)) {\n for (const key of Object.keys(defaultValue)) {\n result[key] = deepCopyObject(defaultValue[key]);\n }\n }\n return result;\n }\n return customValue !== undefined ? customValue : defaultValue;\n};\n\n/**\n * Merges two theme configurations with this priority:\n *\n * 1. Values will be picked up first from the `defaultThemeConfig` and\n * then from the `customizedThemeConfig`.\n * This means that if a value is set in the customized theme, it will 'override' the default.\n * 2. Null values in `customizedThemeConfig` the will override the default with `null`,\n * while undefined values will be ignored.\n * 3. Objects will be merged recursively.\n * All other values, esp. Arrays, will not be merged.\n *\n * @param defaultThemeConfig\n * @param customizedThemeConfig\n * @returns\n */\nexport const mergeUnifiedThemeOptions = (\n defaultThemeConfig: ThemeConfig,\n customizedThemeConfig: ThemeConfig,\n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AAA,CAAY,GAAG,CAAC,CAAA;AAAA;AACpE,KACF,MAAA,IAAW,gBAAgB,IAAM,EAAA;AAC/B,MAAO,OAAA,IAAA;AAAA,KACT,MAAA,IAAW,QAAS,CAAA,WAAW,CAAG,EAAA;AAChC,MAAA,KAAA,MAAW,GAAO,IAAA,MAAA,CAAO,IAAK,CAAA,WAAW,CAAG,EAAA;AAC1C,QAAA,MAAA,CAAO,GAAG,CAAA,GAAI,cAAe,CAAA,WAAA,CAAY,GAAG,CAAC,CAAA;AAAA;AAC/C,KACF,MAAA,IAAW,QAAS,CAAA,YAAY,CAAG,EAAA;AACjC,MAAA,KAAA,MAAW,GAAO,IAAA,MAAA,CAAO,IAAK,CAAA,YAAY,CAAG,EAAA;AAC3C,QAAA,MAAA,CAAO,GAAG,CAAA,GAAI,cAAe,CAAA,YAAA,CAAa,GAAG,CAAC,CAAA;AAAA;AAChD;AAEF,IAAO,OAAA,MAAA;AAAA;AAET,EAAO,OAAA,WAAA,KAAgB,YAAY,WAAc,GAAA,YAAA;AACnD;AAiBa,MAAA,wBAAA,GAA2B,CACtC,kBAAA,EACA,qBACgB,KAAA;AAChB,EAAO,OAAA,gBAAA;AAAA,IACL,kBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateTheme.esm.js","sources":["../../src/utils/migrateTheme.ts"],"sourcesContent":["/*\n * Copyright
|
|
1
|
+
{"version":3,"file":"migrateTheme.esm.js","sources":["../../src/utils/migrateTheme.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\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 type { BackstagePaletteAdditions } from '@backstage/theme';\nimport type { SimplePaletteColorOptions } from '@mui/material/styles';\nimport type { ThemeConfig } from '../types';\n\nexport interface DeprecatedRHDH10to12ThemeColors {\n /**\n * primaryColor Configuration for the instance\n * The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n */\n primaryColor?: string;\n /**\n * Header Theme color Configuration for the instance\n * The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n */\n headerColor1?: string;\n /**\n * Header Theme color Configuration for the instance\n * The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n */\n headerColor2?: string;\n /**\n * Navigation Side Bar Indicator color Configuration for the instance\n * The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()\n */\n navigationIndicatorColor?: string;\n}\n\nfunction isObject(\n objectOrValue: unknown,\n): objectOrValue is Record<string, unknown> {\n return typeof objectOrValue === 'object' && !Array.isArray(objectOrValue);\n}\n\nexport const migrateThemeConfig = (\n themeConfig: ThemeConfig & DeprecatedRHDH10to12ThemeColors,\n): ThemeConfig => {\n if (!themeConfig) {\n return { palette: {} };\n }\n\n // Drop deprecated values from the root level!\n const migrated: ThemeConfig = {\n palette: themeConfig.palette ?? {},\n defaultPageTheme: themeConfig.defaultPageTheme,\n pageTheme: themeConfig.pageTheme,\n fontFamily: themeConfig.fontFamily,\n htmlFontSize: themeConfig.htmlFontSize,\n typography: themeConfig.typography,\n options: themeConfig.options,\n };\n\n if (themeConfig.primaryColor) {\n // eslint-disable-next-line no-console\n console.warn(\n '[deprecated] Automatically migrate theme configuration from `primaryColor` to `palette.primary.main`',\n );\n if (isObject(migrated.palette?.primary)) {\n if (!(migrated.palette.primary as SimplePaletteColorOptions).main) {\n (migrated.palette.primary as SimplePaletteColorOptions).main =\n themeConfig.primaryColor;\n }\n } else if (migrated.palette) {\n migrated.palette.primary = { main: themeConfig.primaryColor };\n }\n }\n\n if (themeConfig.navigationIndicatorColor) {\n // eslint-disable-next-line no-console\n console.warn(\n '[deprecated] Automatically migrate theme configuration from `navigationIndicatorColor` to `palette.navigation.indicator`',\n );\n if (isObject(migrated.palette?.navigation)) {\n if (!migrated.palette.navigation.indicator) {\n migrated.palette.navigation.indicator =\n themeConfig.navigationIndicatorColor;\n }\n } else if (migrated.palette) {\n migrated.palette.navigation = {\n indicator: themeConfig.navigationIndicatorColor,\n } as BackstagePaletteAdditions['navigation'];\n }\n }\n\n if (themeConfig.headerColor1) {\n if (themeConfig.pageTheme) {\n // eslint-disable-next-line no-console\n console.warn(\n '[deprecated] Ignore theme configuration `headerColor1` and `headerColor2` because `pageTheme` is defined!',\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n '[deprecated] Automatically migrate theme configuration from `headerColor1` and `headerColor2` to `pageTheme.home.backgroundColor`',\n );\n migrated.defaultPageTheme = 'home';\n migrated.pageTheme = {\n home: {\n backgroundColor: !themeConfig.headerColor2\n ? themeConfig.headerColor1\n : [themeConfig.headerColor1, themeConfig.headerColor2],\n },\n };\n }\n }\n\n return migrated;\n};\n"],"names":[],"mappings":"AA2CA,SAAS,SACP,aAC0C,EAAA;AAC1C,EAAA,OAAO,OAAO,aAAkB,KAAA,QAAA,IAAY,CAAC,KAAA,CAAM,QAAQ,aAAa,CAAA;AAC1E;AAEa,MAAA,kBAAA,GAAqB,CAChC,WACgB,KAAA;AAChB,EAAA,IAAI,CAAC,WAAa,EAAA;AAChB,IAAO,OAAA,EAAE,OAAS,EAAA,EAAG,EAAA;AAAA;AAIvB,EAAA,MAAM,QAAwB,GAAA;AAAA,IAC5B,OAAA,EAAS,WAAY,CAAA,OAAA,IAAW,EAAC;AAAA,IACjC,kBAAkB,WAAY,CAAA,gBAAA;AAAA,IAC9B,WAAW,WAAY,CAAA,SAAA;AAAA,IACvB,YAAY,WAAY,CAAA,UAAA;AAAA,IACxB,cAAc,WAAY,CAAA,YAAA;AAAA,IAC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,MAAA;AAC5B,MAAA,QAAA,CAAS,SAAY,GAAA;AAAA,QACnB,IAAM,EAAA;AAAA,UACJ,eAAA,EAAiB,CAAC,WAAA,CAAY,YAC1B,GAAA,WAAA,CAAY,eACZ,CAAC,WAAA,CAAY,YAAc,EAAA,WAAA,CAAY,YAAY;AAAA;AACzD,OACF;AAAA;AACF;AAGF,EAAO,OAAA,QAAA;AACT;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@red-hat-developer-hub/backstage-plugin-theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Red Hat Developer Hub Theme",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,20 +29,23 @@
|
|
|
29
29
|
"postpack": "backstage-cli package postpack"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@backstage/core-plugin-api": "^1.10.
|
|
33
|
-
"@backstage/theme": "^0.6.
|
|
32
|
+
"@backstage/core-plugin-api": "^1.10.4",
|
|
33
|
+
"@backstage/theme": "^0.6.4",
|
|
34
34
|
"@material-ui/icons": "^4.11.3",
|
|
35
|
+
"@mui/icons-material": "^5.17.1",
|
|
35
36
|
"@mui/material": "^5.0.0",
|
|
36
37
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@backstage/cli": "^0.
|
|
40
|
-
"@backstage/core-app-api": "^1.15.
|
|
41
|
-
"@backstage/core-
|
|
42
|
-
"@backstage/
|
|
43
|
-
"@backstage/
|
|
44
|
-
"@backstage/
|
|
45
|
-
"@backstage/
|
|
40
|
+
"@backstage/cli": "^0.30.0",
|
|
41
|
+
"@backstage/core-app-api": "^1.15.5",
|
|
42
|
+
"@backstage/core-components": "^0.16.4",
|
|
43
|
+
"@backstage/core-plugin-api": "^1.10.4",
|
|
44
|
+
"@backstage/dev-utils": "^1.1.7",
|
|
45
|
+
"@backstage/plugin-user-settings": "^0.8.19",
|
|
46
|
+
"@backstage/test-utils": "^1.7.5",
|
|
47
|
+
"@backstage/theme": "^0.6.4",
|
|
48
|
+
"@backstage/types": "^1.2.1",
|
|
46
49
|
"@material-ui/icons": "^4.11.3",
|
|
47
50
|
"@testing-library/jest-dom": "^6.0.0",
|
|
48
51
|
"@testing-library/react": "^14.0.0",
|
|
@@ -70,5 +73,15 @@
|
|
|
70
73
|
"@debsmita1",
|
|
71
74
|
"@divyanshiGupta"
|
|
72
75
|
],
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@mui/icons-material": "^5.17.1"
|
|
78
|
+
},
|
|
79
|
+
"typesVersions": {
|
|
80
|
+
"*": {
|
|
81
|
+
"index": [
|
|
82
|
+
"dist/index.d.ts"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
73
86
|
"module": "./dist/index.esm.js"
|
|
74
87
|
}
|