@red-hat-developer-hub/backstage-plugin-global-header 1.8.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/CompanyLogo/CompanyLogo.esm.js +21 -21
  3. package/dist/components/CompanyLogo/CompanyLogo.esm.js.map +1 -1
  4. package/dist/components/CompanyLogo/DefaultLogo.esm.js +199 -154
  5. package/dist/components/CompanyLogo/DefaultLogo.esm.js.map +1 -1
  6. package/dist/components/Divider/Divider.esm.js +3 -3
  7. package/dist/components/Divider/Divider.esm.js.map +1 -1
  8. package/dist/components/GlobalHeader.esm.js +2 -2
  9. package/dist/components/GlobalHeader.esm.js.map +1 -1
  10. package/dist/components/GlobalHeaderComponent.esm.js +13 -12
  11. package/dist/components/GlobalHeaderComponent.esm.js.map +1 -1
  12. package/dist/components/HeaderButton/HeaderButton.esm.js +9 -9
  13. package/dist/components/HeaderButton/HeaderButton.esm.js.map +1 -1
  14. package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js +29 -28
  15. package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js.map +1 -1
  16. package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js +17 -13
  17. package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js.map +1 -1
  18. package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js +16 -14
  19. package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js.map +1 -1
  20. package/dist/components/HeaderDropdownComponent/HeaderDropdownComponent.esm.js +32 -28
  21. package/dist/components/HeaderDropdownComponent/HeaderDropdownComponent.esm.js.map +1 -1
  22. package/dist/components/HeaderDropdownComponent/MenuSection.esm.js +55 -48
  23. package/dist/components/HeaderDropdownComponent/MenuSection.esm.js.map +1 -1
  24. package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js +38 -31
  25. package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js.map +1 -1
  26. package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js +2 -2
  27. package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js.map +1 -1
  28. package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js +15 -11
  29. package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js.map +1 -1
  30. package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js +55 -50
  31. package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js.map +1 -1
  32. package/dist/components/HeaderIcon/HeaderIcon.esm.js +11 -11
  33. package/dist/components/HeaderIcon/HeaderIcon.esm.js.map +1 -1
  34. package/dist/components/HeaderIconButton/HeaderIconButton.esm.js +7 -7
  35. package/dist/components/HeaderIconButton/HeaderIconButton.esm.js.map +1 -1
  36. package/dist/components/LogoutButton/LogoutButton.esm.js +5 -5
  37. package/dist/components/LogoutButton/LogoutButton.esm.js.map +1 -1
  38. package/dist/components/MenuItemLink/MenuItemLink.esm.js +6 -3
  39. package/dist/components/MenuItemLink/MenuItemLink.esm.js.map +1 -1
  40. package/dist/components/MenuItemLink/MenuItemLinkContent.esm.js +46 -39
  41. package/dist/components/MenuItemLink/MenuItemLinkContent.esm.js.map +1 -1
  42. package/dist/components/NotificationBanner.esm.js +9 -8
  43. package/dist/components/NotificationBanner.esm.js.map +1 -1
  44. package/dist/components/NotificationButton/NotificationButton.esm.js +7 -7
  45. package/dist/components/NotificationButton/NotificationButton.esm.js.map +1 -1
  46. package/dist/components/SearchComponent/SearchBar.esm.js +9 -6
  47. package/dist/components/SearchComponent/SearchBar.esm.js.map +1 -1
  48. package/dist/components/SearchComponent/SearchComponent.esm.js +7 -6
  49. package/dist/components/SearchComponent/SearchComponent.esm.js.map +1 -1
  50. package/dist/components/SearchComponent/SearchInput.esm.js +3 -3
  51. package/dist/components/SearchComponent/SearchInput.esm.js.map +1 -1
  52. package/dist/components/SearchComponent/SearchOption.esm.js +19 -13
  53. package/dist/components/SearchComponent/SearchOption.esm.js.map +1 -1
  54. package/dist/components/SearchComponent/SearchResultItem.esm.js +18 -18
  55. package/dist/components/SearchComponent/SearchResultItem.esm.js.map +1 -1
  56. package/dist/components/Spacer/Spacer.esm.js +2 -2
  57. package/dist/components/Spacer/Spacer.esm.js.map +1 -1
  58. package/dist/components/SupportButton/SupportButton.esm.js +17 -17
  59. package/dist/components/SupportButton/SupportButton.esm.js.map +1 -1
  60. package/dist/defaultMountPoints/defaultMountPoints.esm.js.map +1 -1
  61. package/dist/hooks/useDebouncedCallback.esm.js +4 -4
  62. package/dist/hooks/useDebouncedCallback.esm.js.map +1 -1
  63. package/dist/hooks/useDropdownManager.esm.js +2 -2
  64. package/dist/hooks/useDropdownManager.esm.js.map +1 -1
  65. package/dist/index.d.ts +38 -38
  66. package/dist/plugin.esm.js +2 -1
  67. package/dist/plugin.esm.js.map +1 -1
  68. package/dist/utils/stringUtils.esm.js +12 -12
  69. package/dist/utils/stringUtils.esm.js.map +1 -1
  70. package/package.json +25 -25
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { useApp } from '@backstage/core-plugin-api';
3
3
  import MuiIcon from '@mui/material/Icon';
4
4
  import Box from '@mui/material/Box';
@@ -14,31 +14,31 @@ const HeaderIcon = ({
14
14
  }
15
15
  const SystemIcon = app.getSystemIcon(icon);
16
16
  if (SystemIcon) {
17
- return /* @__PURE__ */ React.createElement(Box, { sx: { display: "flex", alignItems: "center", ...layout } }, /* @__PURE__ */ React.createElement(SystemIcon, { fontSize: size }));
17
+ return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center", ...layout }, children: /* @__PURE__ */ jsx(SystemIcon, { fontSize: size }) });
18
18
  }
19
19
  if (icon.startsWith("<svg")) {
20
20
  const svgDataUri = `data:image/svg+xml;base64,${btoa(icon)}`;
21
- return /* @__PURE__ */ React.createElement(MuiIcon, { fontSize: size, sx: layout }, /* @__PURE__ */ React.createElement("img", { src: svgDataUri, alt: "" }));
21
+ return /* @__PURE__ */ jsx(MuiIcon, { fontSize: size, sx: layout, children: /* @__PURE__ */ jsx("img", { src: svgDataUri, alt: "" }) });
22
22
  }
23
23
  if (icon.startsWith("https://") || icon.startsWith("http://") || icon.startsWith("/")) {
24
- return /* @__PURE__ */ React.createElement(
24
+ return /* @__PURE__ */ jsx(
25
25
  MuiIcon,
26
26
  {
27
27
  fontSize: size,
28
28
  baseClassName: "material-icons-outlined",
29
- sx: layout
30
- },
31
- /* @__PURE__ */ React.createElement("img", { src: icon, alt: "", height: "100%", width: "100%" })
29
+ sx: layout,
30
+ children: /* @__PURE__ */ jsx("img", { src: icon, alt: "", height: "100%", width: "100%" })
31
+ }
32
32
  );
33
33
  }
34
- return /* @__PURE__ */ React.createElement(
34
+ return /* @__PURE__ */ jsx(
35
35
  MuiIcon,
36
36
  {
37
37
  fontSize: size,
38
38
  baseClassName: "material-icons-outlined",
39
- sx: layout
40
- },
41
- icon
39
+ sx: layout,
40
+ children: icon
41
+ }
42
42
  );
43
43
  };
44
44
 
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderIcon.esm.js","sources":["../../../src/components/HeaderIcon/HeaderIcon.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 */\nimport React from 'react';\nimport { useApp } from '@backstage/core-plugin-api';\nimport MuiIcon from '@mui/material/Icon';\nimport Box from '@mui/material/Box';\n\n/**\n * @public\n */\nexport interface HeaderIconProps {\n icon: string;\n size?: 'small' | 'medium' | 'large';\n layout?: React.CSSProperties;\n}\n\n/**\n * @public\n */\nexport const HeaderIcon = ({\n icon,\n size = 'small',\n layout,\n}: HeaderIconProps) => {\n const app = useApp();\n if (!icon) {\n return null;\n }\n\n const SystemIcon = app.getSystemIcon(icon);\n if (SystemIcon) {\n return (\n <Box sx={{ display: 'flex', alignItems: 'center', ...layout }}>\n <SystemIcon fontSize={size} />\n </Box>\n );\n }\n\n if (icon.startsWith('<svg')) {\n const svgDataUri = `data:image/svg+xml;base64,${btoa(icon)}`;\n return (\n <MuiIcon fontSize={size} sx={layout}>\n <img src={svgDataUri} alt=\"\" />\n </MuiIcon>\n );\n }\n\n if (\n icon.startsWith('https://') ||\n icon.startsWith('http://') ||\n icon.startsWith('/')\n ) {\n return (\n <MuiIcon\n fontSize={size}\n baseClassName=\"material-icons-outlined\"\n sx={layout}\n >\n <img src={icon} alt=\"\" height=\"100%\" width=\"100%\" />\n </MuiIcon>\n );\n }\n\n return (\n <MuiIcon\n fontSize={size}\n baseClassName=\"material-icons-outlined\"\n sx={layout}\n >\n {icon}\n </MuiIcon>\n );\n};\n"],"names":[],"mappings":";;;;;AAgCO,MAAM,aAAa,CAAC;AAAA,EACzB,IAAA;AAAA,EACA,IAAO,GAAA,OAAA;AAAA,EACP;AACF,CAAuB,KAAA;AACrB,EAAA,MAAM,MAAM,MAAO,EAAA;AACnB,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,IAAA;AAAA;AAGT,EAAM,MAAA,UAAA,GAAa,GAAI,CAAA,aAAA,CAAc,IAAI,CAAA;AACzC,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,EAAE,SAAS,MAAQ,EAAA,UAAA,EAAY,QAAU,EAAA,GAAG,QACnD,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,QAAA,EAAU,MAAM,CAC9B,CAAA;AAAA;AAIJ,EAAI,IAAA,IAAA,CAAK,UAAW,CAAA,MAAM,CAAG,EAAA;AAC3B,IAAA,MAAM,UAAa,GAAA,CAAA,0BAAA,EAA6B,IAAK,CAAA,IAAI,CAAC,CAAA,CAAA;AAC1D,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,QAAU,EAAA,IAAA,EAAM,EAAI,EAAA,MAAA,EAAA,kBAC1B,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,GAAK,EAAA,UAAA,EAAY,GAAI,EAAA,EAAA,EAAG,CAC/B,CAAA;AAAA;AAIJ,EACE,IAAA,IAAA,CAAK,UAAW,CAAA,UAAU,CAC1B,IAAA,IAAA,CAAK,UAAW,CAAA,SAAS,CACzB,IAAA,IAAA,CAAK,UAAW,CAAA,GAAG,CACnB,EAAA;AACA,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,QAAU,EAAA,IAAA;AAAA,QACV,aAAc,EAAA,yBAAA;AAAA,QACd,EAAI,EAAA;AAAA,OAAA;AAAA,sBAEJ,KAAA,CAAA,aAAA,CAAC,SAAI,GAAK,EAAA,IAAA,EAAM,KAAI,EAAG,EAAA,MAAA,EAAO,MAAO,EAAA,KAAA,EAAM,MAAO,EAAA;AAAA,KACpD;AAAA;AAIJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA,IAAA;AAAA,MACV,aAAc,EAAA,yBAAA;AAAA,MACd,EAAI,EAAA;AAAA,KAAA;AAAA,IAEH;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"HeaderIcon.esm.js","sources":["../../../src/components/HeaderIcon/HeaderIcon.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 */\nimport type { CSSProperties } from 'react';\nimport { useApp } from '@backstage/core-plugin-api';\nimport MuiIcon from '@mui/material/Icon';\nimport Box from '@mui/material/Box';\n\n/**\n * @public\n */\nexport interface HeaderIconProps {\n icon: string;\n size?: 'small' | 'medium' | 'large';\n layout?: CSSProperties;\n}\n\n/**\n * @public\n */\nexport const HeaderIcon = ({\n icon,\n size = 'small',\n layout,\n}: HeaderIconProps) => {\n const app = useApp();\n if (!icon) {\n return null;\n }\n\n const SystemIcon = app.getSystemIcon(icon);\n if (SystemIcon) {\n return (\n <Box sx={{ display: 'flex', alignItems: 'center', ...layout }}>\n <SystemIcon fontSize={size} />\n </Box>\n );\n }\n\n if (icon.startsWith('<svg')) {\n const svgDataUri = `data:image/svg+xml;base64,${btoa(icon)}`;\n return (\n <MuiIcon fontSize={size} sx={layout}>\n <img src={svgDataUri} alt=\"\" />\n </MuiIcon>\n );\n }\n\n if (\n icon.startsWith('https://') ||\n icon.startsWith('http://') ||\n icon.startsWith('/')\n ) {\n return (\n <MuiIcon\n fontSize={size}\n baseClassName=\"material-icons-outlined\"\n sx={layout}\n >\n <img src={icon} alt=\"\" height=\"100%\" width=\"100%\" />\n </MuiIcon>\n );\n }\n\n return (\n <MuiIcon\n fontSize={size}\n baseClassName=\"material-icons-outlined\"\n sx={layout}\n >\n {icon}\n </MuiIcon>\n );\n};\n"],"names":[],"mappings":";;;;;AAgCO,MAAM,aAAa,CAAC;AAAA,EACzB,IAAA;AAAA,EACA,IAAO,GAAA,OAAA;AAAA,EACP;AACF,CAAuB,KAAA;AACrB,EAAA,MAAM,MAAM,MAAO,EAAA;AACnB,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAO,OAAA,IAAA;AAAA;AAGT,EAAM,MAAA,UAAA,GAAa,GA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AAA,MAEH,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -1,11 +1,11 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { Link as Link$1 } from '@backstage/core-components';
3
3
  import Box from '@mui/material/Box';
4
4
  import IconButton from '@mui/material/IconButton';
5
5
  import Tooltip from '@mui/material/Tooltip';
6
6
  import { HeaderIcon } from '../HeaderIcon/HeaderIcon.esm.js';
7
7
 
8
- const Link = (props) => /* @__PURE__ */ React.createElement(Link$1, { ...props, color: "inherit", externalLinkIcon: false });
8
+ const Link = (props) => /* @__PURE__ */ jsx(Link$1, { ...props, color: "inherit", externalLinkIcon: false });
9
9
  const HeaderIconButton = ({
10
10
  title,
11
11
  icon,
@@ -20,17 +20,17 @@ const HeaderIconButton = ({
20
20
  console.warn("HeaderIconButton has no title:", { icon, to });
21
21
  }
22
22
  const linkProps = { to };
23
- return /* @__PURE__ */ React.createElement(Box, { sx: layout }, /* @__PURE__ */ React.createElement(Tooltip, { title: tooltip ?? title }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
23
+ return /* @__PURE__ */ jsx(Box, { sx: layout, children: /* @__PURE__ */ jsx(Tooltip, { title: tooltip ?? title, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
24
24
  IconButton,
25
25
  {
26
26
  LinkComponent: Link,
27
27
  color,
28
28
  size,
29
29
  "aria-label": ariaLabel ?? title,
30
- ...linkProps
31
- },
32
- /* @__PURE__ */ React.createElement(HeaderIcon, { icon, size })
33
- ))));
30
+ ...linkProps,
31
+ children: /* @__PURE__ */ jsx(HeaderIcon, { icon, size })
32
+ }
33
+ ) }) }) });
34
34
  };
35
35
 
36
36
  export { HeaderIconButton };
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderIconButton.esm.js","sources":["../../../src/components/HeaderIconButton/HeaderIconButton.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';\n\nimport { Link as BackstageLink } from '@backstage/core-components';\n\nimport Box from '@mui/material/Box';\nimport IconButton, { IconButtonProps } from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { HeaderIcon } from '../HeaderIcon/HeaderIcon';\n\n/**\n * @public\n */\nexport interface HeaderIconButtonProps {\n title: string;\n icon: string;\n tooltip?: string;\n color?: 'inherit' | 'primary' | 'secondary' | 'default';\n size?: 'small' | 'medium' | 'large';\n ariaLabel?: string;\n to: string;\n layout?: React.CSSProperties;\n}\n\n// Backstage Link automatically detects external links and emits analytic events.\nconst Link = (props: any) => (\n <BackstageLink {...props} color=\"inherit\" externalLinkIcon={false} />\n);\n\nexport const HeaderIconButton = ({\n title,\n icon,\n tooltip,\n color = 'inherit',\n size = 'small',\n ariaLabel,\n to,\n layout,\n}: HeaderIconButtonProps) => {\n if (!title) {\n // eslint-disable-next-line no-console\n console.warn('HeaderIconButton has no title:', { icon, to });\n }\n\n const linkProps = { to } as IconButtonProps;\n\n return (\n <Box sx={layout}>\n <Tooltip title={tooltip ?? title}>\n <div>\n <IconButton\n LinkComponent={Link}\n color={color}\n size={size}\n aria-label={ariaLabel ?? title}\n {...linkProps} // to={to} isn't supported\n >\n <HeaderIcon icon={icon} size={size} />\n </IconButton>\n </div>\n </Tooltip>\n </Box>\n );\n};\n"],"names":["BackstageLink"],"mappings":";;;;;;;AAyCA,MAAM,IAAA,GAAO,CAAC,KAAA,qBACX,KAAA,CAAA,aAAA,CAAAA,MAAA,EAAA,EAAe,GAAG,KAAO,EAAA,KAAA,EAAM,SAAU,EAAA,gBAAA,EAAkB,KAAO,EAAA,CAAA;AAG9D,MAAM,mBAAmB,CAAC;AAAA,EAC/B,KAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAQ,GAAA,SAAA;AAAA,EACR,IAAO,GAAA,OAAA;AAAA,EACP,SAAA;AAAA,EACA,EAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAA,IAAI,CAAC,KAAO,EAAA;AAEV,IAAA,OAAA,CAAQ,IAAK,CAAA,gCAAA,EAAkC,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA;AAG7D,EAAM,MAAA,SAAA,GAAY,EAAE,EAAG,EAAA;AAEvB,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,MACP,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,KAAO,EAAA,OAAA,IAAW,KACzB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,aAAe,EAAA,IAAA;AAAA,MACf,KAAA;AAAA,MACA,IAAA;AAAA,MACA,cAAY,SAAa,IAAA,KAAA;AAAA,MACxB,GAAG;AAAA,KAAA;AAAA,oBAEJ,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,IAAA,EAAY,IAAY,EAAA;AAAA,GAExC,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"HeaderIconButton.esm.js","sources":["../../../src/components/HeaderIconButton/HeaderIconButton.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 type { CSSProperties } from 'react';\nimport { Link as BackstageLink } from '@backstage/core-components';\n\nimport Box from '@mui/material/Box';\nimport IconButton, { IconButtonProps } from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport { HeaderIcon } from '../HeaderIcon/HeaderIcon';\n\n/**\n * @public\n */\nexport interface HeaderIconButtonProps {\n title: string;\n icon: string;\n tooltip?: string;\n color?: 'inherit' | 'primary' | 'secondary' | 'default';\n size?: 'small' | 'medium' | 'large';\n ariaLabel?: string;\n to: string;\n layout?: CSSProperties;\n}\n\n// Backstage Link automatically detects external links and emits analytic events.\nconst Link = (props: any) => (\n <BackstageLink {...props} color=\"inherit\" externalLinkIcon={false} />\n);\n\nexport const HeaderIconButton = ({\n title,\n icon,\n tooltip,\n color = 'inherit',\n size = 'small',\n ariaLabel,\n to,\n layout,\n}: HeaderIconButtonProps) => {\n if (!title) {\n // eslint-disable-next-line no-console\n console.warn('HeaderIconButton has no title:', { icon, to });\n }\n\n const linkProps = { to } as IconButtonProps;\n\n return (\n <Box sx={layout}>\n <Tooltip title={tooltip ?? title}>\n <div>\n <IconButton\n LinkComponent={Link}\n color={color}\n size={size}\n aria-label={ariaLabel ?? title}\n {...linkProps} // to={to} isn't supported\n >\n <HeaderIcon icon={icon} size={size} />\n </IconButton>\n </div>\n </Tooltip>\n </Box>\n );\n};\n"],"names":["BackstageLink"],"mappings":";;;;;;;AAwCA,MAAM,IAAA,GAAO,CAAC,KAAA,qBACX,GAAA,CAAAA,MAAA,EAAA,EAAe,GAAG,KAAO,EAAA,KAAA,EAAM,SAAU,EAAA,gBAAA,EAAkB,KAAO,EAAA,CAAA;AAG9D,MAAM,mBAAmB,CAAC;AAAA,EAC/B,KAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAQ,GAAA,SAAA;AAAA,EACR,IAAO,GAAA,OAAA;AAAA,EACP,SAAA;AAAA,EACA,EAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAA,IAAI,CAAC,KAAO,EAAA;AAEV,IAAA,OAAA,CAAQ,IAAK,CAAA,gCAAA,EAAkC,EAAE,IAAA,EAAM,IAAI,CAAA;AAAA;AAG7D,EAAM,MAAA,SAAA,GAAY,EAAE,EAAG,EAAA;AAEvB,EACE,uBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,MACP,EAAA,QAAA,kBAAA,GAAA,CAAC,WAAQ,KAAO,EAAA,OAAA,IAAW,KACzB,EAAA,QAAA,kBAAA,GAAA,CAAC,KACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,aAAe,EAAA,IAAA;AAAA,MACf,KAAA;AAAA,MACA,IAAA;AAAA,MACA,cAAY,SAAa,IAAA,KAAA;AAAA,MACxB,GAAG,SAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,IAAA,EAAY,IAAY,EAAA;AAAA;AAAA,GACtC,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { useApi, errorApiRef, identityApiRef } from '@backstage/core-plugin-api';
3
3
  import MenuItem from '@mui/material/MenuItem';
4
4
  import { MenuItemLinkContent } from '../MenuItemLink/MenuItemLinkContent.esm.js';
@@ -9,13 +9,13 @@ const LogoutButton = () => {
9
9
  const handleLogout = () => {
10
10
  identityApi.signOut().catch((error) => errorApi.post(error));
11
11
  };
12
- return /* @__PURE__ */ React.createElement(
12
+ return /* @__PURE__ */ jsx(
13
13
  MenuItem,
14
14
  {
15
15
  onClick: handleLogout,
16
- sx: { cursor: "pointer", width: "100%", color: "inherit" }
17
- },
18
- /* @__PURE__ */ React.createElement(MenuItemLinkContent, { icon: "logout", label: "Sign out" })
16
+ sx: { cursor: "pointer", width: "100%", color: "inherit" },
17
+ children: /* @__PURE__ */ jsx(MenuItemLinkContent, { icon: "logout", label: "Sign out" })
18
+ }
19
19
  );
20
20
  };
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"LogoutButton.esm.js","sources":["../../../src/components/LogoutButton/LogoutButton.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';\n\nimport {\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n\nimport MenuItem from '@mui/material/MenuItem';\n\nimport { MenuItemLinkContent } from '../MenuItemLink/MenuItemLinkContent';\n\nexport const LogoutButton = () => {\n const errorApi = useApi(errorApiRef);\n const identityApi = useApi(identityApiRef);\n\n const handleLogout = () => {\n identityApi.signOut().catch(error => errorApi.post(error));\n };\n\n return (\n <MenuItem\n onClick={handleLogout}\n sx={{ cursor: 'pointer', width: '100%', color: 'inherit' }}\n >\n <MenuItemLinkContent icon=\"logout\" label=\"Sign out\" />\n </MenuItem>\n );\n};\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,WAAA,CAAY,SAAU,CAAA,KAAA,CAAM,WAAS,QAAS,CAAA,IAAA,CAAK,KAAK,CAAC,CAAA;AAAA,GAC3D;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,IAAI,EAAE,MAAA,EAAQ,WAAW,KAAO,EAAA,MAAA,EAAQ,OAAO,SAAU;AAAA,KAAA;AAAA,oBAExD,KAAA,CAAA,aAAA,CAAA,mBAAA,EAAA,EAAoB,IAAK,EAAA,QAAA,EAAS,OAAM,UAAW,EAAA;AAAA,GACtD;AAEJ;;;;"}
1
+ {"version":3,"file":"LogoutButton.esm.js","sources":["../../../src/components/LogoutButton/LogoutButton.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 {\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n\nimport MenuItem from '@mui/material/MenuItem';\n\nimport { MenuItemLinkContent } from '../MenuItemLink/MenuItemLinkContent';\n\nexport const LogoutButton = () => {\n const errorApi = useApi(errorApiRef);\n const identityApi = useApi(identityApiRef);\n\n const handleLogout = () => {\n identityApi.signOut().catch(error => errorApi.post(error));\n };\n\n return (\n <MenuItem\n onClick={handleLogout}\n sx={{ cursor: 'pointer', width: '100%', color: 'inherit' }}\n >\n <MenuItemLinkContent icon=\"logout\" label=\"Sign out\" />\n </MenuItem>\n );\n};\n"],"names":[],"mappings":";;;;;AA0BO,MAAM,eAAe,MAAM;AAChC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AAEzC,EAAA,MAAM,eAAe,MAAM;AACzB,IAAA,WAAA,CAAY,SAAU,CAAA,KAAA,CAAM,WAAS,QAAS,CAAA,IAAA,CAAK,KAAK,CAAC,CAAA;AAAA,GAC3D;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,IAAI,EAAE,MAAA,EAAQ,WAAW,KAAO,EAAA,MAAA,EAAQ,OAAO,SAAU,EAAA;AAAA,MAEzD,QAAC,kBAAA,GAAA,CAAA,mBAAA,EAAA,EAAoB,IAAK,EAAA,QAAA,EAAS,OAAM,UAAW,EAAA;AAAA;AAAA,GACtD;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import Tooltip from '@mui/material/Tooltip';
3
3
  import { MenuItemLinkContent } from './MenuItemLinkContent.esm.js';
4
4
 
@@ -10,7 +10,7 @@ const MenuItemLink = ({
10
10
  tooltip
11
11
  }) => {
12
12
  const isExternalLink = to.startsWith("http://") || to.startsWith("https://");
13
- const headerLinkContent = () => /* @__PURE__ */ React.createElement(
13
+ const headerLinkContent = () => /* @__PURE__ */ jsx(
14
14
  MenuItemLinkContent,
15
15
  {
16
16
  icon,
@@ -19,7 +19,10 @@ const MenuItemLink = ({
19
19
  isExternalLink
20
20
  }
21
21
  );
22
- return /* @__PURE__ */ React.createElement(React.Fragment, null, tooltip && /* @__PURE__ */ React.createElement(Tooltip, { title: tooltip }, /* @__PURE__ */ React.createElement("div", null, headerLinkContent())), !tooltip && headerLinkContent());
22
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ tooltip && /* @__PURE__ */ jsx(Tooltip, { title: tooltip, children: /* @__PURE__ */ jsx("div", { children: headerLinkContent() }) }),
24
+ !tooltip && headerLinkContent()
25
+ ] });
23
26
  };
24
27
 
25
28
  export { MenuItemLink };
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItemLink.esm.js","sources":["../../../src/components/MenuItemLink/MenuItemLink.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 Tooltip from '@mui/material/Tooltip';\nimport { MenuItemLinkContent } from './MenuItemLinkContent';\n\n/**\n * Header Icon Button properties\n * @public\n */\nexport interface MenuItemLinkProps {\n to: string;\n title?: string;\n subTitle?: string;\n icon?: string;\n tooltip?: string;\n}\n\nexport const MenuItemLink = ({\n to,\n title,\n subTitle,\n icon,\n tooltip,\n}: MenuItemLinkProps) => {\n const isExternalLink = to.startsWith('http://') || to.startsWith('https://');\n\n const headerLinkContent = () => (\n <MenuItemLinkContent\n icon={icon}\n label={title}\n subLabel={subTitle}\n isExternalLink={isExternalLink}\n />\n );\n\n return (\n <>\n {tooltip && (\n <Tooltip title={tooltip}>\n <div>{headerLinkContent()}</div>\n </Tooltip>\n )}\n {!tooltip && headerLinkContent()}\n </>\n );\n};\n"],"names":[],"mappings":";;;;AAgCO,MAAM,eAAe,CAAC;AAAA,EAC3B,EAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAyB,KAAA;AACvB,EAAA,MAAM,iBAAiB,EAAG,CAAA,UAAA,CAAW,SAAS,CAAK,IAAA,EAAA,CAAG,WAAW,UAAU,CAAA;AAE3E,EAAA,MAAM,oBAAoB,sBACxB,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,KAAO,EAAA,KAAA;AAAA,MACP,QAAU,EAAA,QAAA;AAAA,MACV;AAAA;AAAA,GACF;AAGF,EAAA,uBAEK,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,OAAA,oBACE,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,OAAO,OACd,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,IAAA,EAAA,iBAAA,EAAoB,CAC5B,CAAA,EAED,CAAC,OAAA,IAAW,mBACf,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"MenuItemLink.esm.js","sources":["../../../src/components/MenuItemLink/MenuItemLink.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 Tooltip from '@mui/material/Tooltip';\nimport { MenuItemLinkContent } from './MenuItemLinkContent';\n\n/**\n * Header Icon Button properties\n * @public\n */\nexport interface MenuItemLinkProps {\n to: string;\n title?: string;\n subTitle?: string;\n icon?: string;\n tooltip?: string;\n}\n\nexport const MenuItemLink = ({\n to,\n title,\n subTitle,\n icon,\n tooltip,\n}: MenuItemLinkProps) => {\n const isExternalLink = to.startsWith('http://') || to.startsWith('https://');\n\n const headerLinkContent = () => (\n <MenuItemLinkContent\n icon={icon}\n label={title}\n subLabel={subTitle}\n isExternalLink={isExternalLink}\n />\n );\n\n return (\n <>\n {tooltip && (\n <Tooltip title={tooltip}>\n <div>{headerLinkContent()}</div>\n </Tooltip>\n )}\n {!tooltip && headerLinkContent()}\n </>\n );\n};\n"],"names":[],"mappings":";;;;AA+BO,MAAM,eAAe,CAAC;AAAA,EAC3B,EAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAyB,KAAA;AACvB,EAAA,MAAM,iBAAiB,EAAG,CAAA,UAAA,CAAW,SAAS,CAAK,IAAA,EAAA,CAAG,WAAW,UAAU,CAAA;AAE3E,EAAA,MAAM,oBAAoB,sBACxB,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,KAAO,EAAA,KAAA;AAAA,MACP,QAAU,EAAA,QAAA;AAAA,MACV;AAAA;AAAA,GACF;AAGF,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IACC,OAAA,oBAAA,GAAA,CAAC,WAAQ,KAAO,EAAA,OAAA,EACd,8BAAC,KAAK,EAAA,EAAA,QAAA,EAAA,iBAAA,IAAoB,CAC5B,EAAA,CAAA;AAAA,IAED,CAAC,WAAW,iBAAkB;AAAA,GACjC,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import Typography from '@mui/material/Typography';
3
3
  import Box from '@mui/material/Box';
4
4
  import { HeaderIcon } from '../HeaderIcon/HeaderIcon.esm.js';
@@ -12,7 +12,7 @@ const MenuItemLinkContent = ({
12
12
  isExternalLink = false
13
13
  }) => {
14
14
  const theme = useTheme();
15
- return /* @__PURE__ */ React.createElement(
15
+ return /* @__PURE__ */ jsxs(
16
16
  Box,
17
17
  {
18
18
  sx: {
@@ -22,44 +22,51 @@ const MenuItemLinkContent = ({
22
22
  margin: "8px 0",
23
23
  color: "inherit",
24
24
  width: "100%"
25
- }
26
- },
27
- /* @__PURE__ */ React.createElement(Box, { sx: { display: "flex", alignItems: "center" } }, icon && /* @__PURE__ */ React.createElement(
28
- HeaderIcon,
29
- {
30
- icon,
31
- size: "small",
32
- layout: label ? {
33
- marginRight: "0.5rem",
34
- flexShrink: 0,
35
- display: "flex",
36
- alignItems: "center",
37
- // Ensure the icon is centered
38
- color: theme.palette.mode === "dark" ? theme.palette.text.primary : theme.palette.text.disabled
39
- } : {}
40
- }
41
- ), /* @__PURE__ */ React.createElement(
42
- Box,
43
- {
44
- sx: {
45
- display: "flex",
46
- flexDirection: "column",
47
- justifyContent: "center"
48
- }
49
25
  },
50
- label && /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: theme.palette.text.primary }, label),
51
- subLabel && /* @__PURE__ */ React.createElement(Typography, { variant: "caption", color: theme.palette.text.secondary }, subLabel)
52
- )),
53
- isExternalLink && /* @__PURE__ */ React.createElement(
54
- LaunchIcon,
55
- {
56
- sx: {
57
- fontSize: 16,
58
- color: theme.palette.text.secondary,
59
- ml: 1
60
- }
61
- }
62
- )
26
+ children: [
27
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
28
+ icon && /* @__PURE__ */ jsx(
29
+ HeaderIcon,
30
+ {
31
+ icon,
32
+ size: "small",
33
+ layout: label ? {
34
+ marginRight: "0.5rem",
35
+ flexShrink: 0,
36
+ display: "flex",
37
+ alignItems: "center",
38
+ // Ensure the icon is centered
39
+ color: theme.palette.mode === "dark" ? theme.palette.text.primary : theme.palette.text.disabled
40
+ } : {}
41
+ }
42
+ ),
43
+ /* @__PURE__ */ jsxs(
44
+ Box,
45
+ {
46
+ sx: {
47
+ display: "flex",
48
+ flexDirection: "column",
49
+ justifyContent: "center"
50
+ },
51
+ children: [
52
+ label && /* @__PURE__ */ jsx(Typography, { variant: "body2", color: theme.palette.text.primary, children: label }),
53
+ subLabel && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: theme.palette.text.secondary, children: subLabel })
54
+ ]
55
+ }
56
+ )
57
+ ] }),
58
+ isExternalLink && /* @__PURE__ */ jsx(
59
+ LaunchIcon,
60
+ {
61
+ sx: {
62
+ fontSize: 16,
63
+ color: theme.palette.text.secondary,
64
+ ml: 1
65
+ }
66
+ }
67
+ )
68
+ ]
69
+ }
63
70
  );
64
71
  };
65
72
 
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItemLinkContent.esm.js","sources":["../../../src/components/MenuItemLink/MenuItemLinkContent.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 */\nimport React from 'react';\nimport Typography from '@mui/material/Typography';\nimport Box from '@mui/material/Box';\nimport { HeaderIcon } from '../HeaderIcon/HeaderIcon';\nimport { useTheme } from '@mui/material/styles';\nimport LaunchIcon from '@mui/icons-material/Launch';\n\ninterface MenuItemLinkContentProps {\n icon?: string;\n label?: string;\n subLabel?: string;\n isExternalLink?: boolean;\n}\n\nexport const MenuItemLinkContent: React.FC<MenuItemLinkContentProps> = ({\n icon,\n label,\n subLabel,\n isExternalLink = false,\n}) => {\n const theme = useTheme();\n return (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n margin: '8px 0',\n color: 'inherit',\n width: '100%',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n {icon && (\n <HeaderIcon\n icon={icon}\n size=\"small\"\n layout={\n label\n ? {\n marginRight: '0.5rem',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'center', // Ensure the icon is centered\n color:\n theme.palette.mode === 'dark'\n ? theme.palette.text.primary\n : theme.palette.text.disabled,\n }\n : {}\n }\n />\n )}\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n }}\n >\n {label && (\n <Typography variant=\"body2\" color={theme.palette.text.primary}>\n {label}\n </Typography>\n )}\n {subLabel && (\n <Typography variant=\"caption\" color={theme.palette.text.secondary}>\n {subLabel}\n </Typography>\n )}\n </Box>\n </Box>\n {isExternalLink && (\n <LaunchIc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QAAA;AAAA,UACf,cAAgB,EAAA;AAAA;AAClB,OAAA;AAAA,MAEC,KAAA,oBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EAAQ,OAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,OAAA,EAAA,EACnD,KACH,CAAA;AAAA,MAED,QAAA,oBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,SAAA,EAAU,OAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA,EAAA,EACrD,QACH;AAAA,KAGN,CAAA;AAAA,IACC,cACC,oBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA;AAAA,UACF,QAAU,EAAA,EAAA;AAAA,UACV,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,UAC1B,EAAI,EAAA;AAAA;AACN;AAAA;AACF,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"MenuItemLinkContent.esm.js","sources":["../../../src/components/MenuItemLink/MenuItemLinkContent.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 */\nimport type { FC } from 'react';\nimport Typography from '@mui/material/Typography';\nimport Box from '@mui/material/Box';\nimport { HeaderIcon } from '../HeaderIcon/HeaderIcon';\nimport { useTheme } from '@mui/material/styles';\nimport LaunchIcon from '@mui/icons-material/Launch';\n\ninterface MenuItemLinkContentProps {\n icon?: string;\n label?: string;\n subLabel?: string;\n isExternalLink?: boolean;\n}\n\nexport const MenuItemLinkContent: FC<MenuItemLinkContentProps> = ({\n icon,\n label,\n subLabel,\n isExternalLink = false,\n}) => {\n const theme = useTheme();\n return (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n margin: '8px 0',\n color: 'inherit',\n width: '100%',\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n {icon && (\n <HeaderIcon\n icon={icon}\n size=\"small\"\n layout={\n label\n ? {\n marginRight: '0.5rem',\n flexShrink: 0,\n display: 'flex',\n alignItems: 'center', // Ensure the icon is centered\n color:\n theme.palette.mode === 'dark'\n ? theme.palette.text.primary\n : theme.palette.text.disabled,\n }\n : {}\n }\n />\n )}\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n }}\n >\n {label && (\n <Typography variant=\"body2\" color={theme.palette.text.primary}>\n {label}\n </Typography>\n )}\n {subLabel && (\n <Typography variant=\"caption\" color={theme.palette.text.secondary}>\n {subLabel}\n </Typography>\n )}\n </Box>\n </Box>\n {isExternalLink && (\n <LaunchIcon\n sx={{\n fontSize: 16,\n color: theme.palette.text.secondary,\n ml: 1,\n }}\n />\n )}\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,sBAAoD,CAAC;AAAA,EAChE,IAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,cAAiB,GAAA;AACnB,CAAM,KAAA;AACJ,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EACE,uBAAA,IAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,OAAS,EAAA,MAAA;AAAA,QACT,UAAY,EAAA,QAAA;AAAA,QACZ,cAAgB,EAAA,eAAA;AAAA,QAChB,MAAQ,EAAA,OAAA;AAAA,QACR,KAAO,EAAA,SAAA;AAAA,QACP,KAAO,EAAA;AAAA,OACT;AAAA,MAEA,QAAA,EAAA;AAA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,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,cAC1B,EAAI,EAAA;AAAA;AACN;AAAA;AACF;AAAA;AAAA,GAEJ;AAEJ;;;;"}
@@ -1,10 +1,11 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useState, useMemo } from 'react';
2
3
  import { MarkdownContent } from '@backstage/core-components';
3
4
  import Alert from '@mui/material/Alert';
4
5
  import { HeaderIcon } from './HeaderIcon/HeaderIcon.esm.js';
5
6
 
6
7
  const NotificationBanner = (props) => {
7
- const [dismissed, setDismissed] = React.useState(() => {
8
+ const [dismissed, setDismissed] = useState(() => {
8
9
  if (props.dismiss === "localstorage") {
9
10
  try {
10
11
  const dismissedString = localStorage.getItem("global-header/NotificationBanner") ?? "{}";
@@ -17,7 +18,7 @@ const NotificationBanner = (props) => {
17
18
  return false;
18
19
  }
19
20
  });
20
- const onClose = React.useMemo(() => {
21
+ const onClose = useMemo(() => {
21
22
  if (!props.dismiss || props.dismiss === "none") {
22
23
  return void 0;
23
24
  } else if (props.dismiss === "session") {
@@ -45,11 +46,11 @@ const NotificationBanner = (props) => {
45
46
  if (dismissed || !props.title) {
46
47
  return null;
47
48
  }
48
- return /* @__PURE__ */ React.createElement(
49
+ return /* @__PURE__ */ jsx(
49
50
  Alert,
50
51
  {
51
52
  color: "warning",
52
- icon: props.icon ? /* @__PURE__ */ React.createElement(HeaderIcon, { icon: props.icon }) : false,
53
+ icon: props.icon ? /* @__PURE__ */ jsx(HeaderIcon, { icon: props.icon }) : false,
53
54
  onClose,
54
55
  sx: {
55
56
  color: props.textColor,
@@ -61,9 +62,9 @@ const NotificationBanner = (props) => {
61
62
  justifyContent: "center",
62
63
  textAlign: "center",
63
64
  ...props.layout
64
- }
65
- },
66
- props.markdown ? /* @__PURE__ */ React.createElement(MarkdownContent, { content: props.title, dialect: "gfm" }) : props.title
65
+ },
66
+ children: props.markdown ? /* @__PURE__ */ jsx(MarkdownContent, { content: props.title, dialect: "gfm" }) : props.title
67
+ }
67
68
  );
68
69
  };
69
70
 
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationBanner.esm.js","sources":["../../src/components/NotificationBanner.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';\n\nimport { MarkdownContent } from '@backstage/core-components';\n\nimport Alert from '@mui/material/Alert';\n\nimport { HeaderIcon } from './HeaderIcon/HeaderIcon';\n\n/**\n * @public\n */\nexport type NotificationBannerDismiss = 'none' | 'session' | 'localstorage';\n\n/**\n * @public\n */\nexport interface NotificationBannerProps {\n id?: string;\n title: string;\n markdown?: boolean;\n icon?: string;\n\n textColor?: string;\n backgroundColor?: string;\n borderColor?: string;\n layout?: React.CSSProperties;\n\n dismiss?: NotificationBannerDismiss;\n}\n\nexport const NotificationBanner = (props: NotificationBannerProps) => {\n const [dismissed, setDismissed] = React.useState<boolean>(() => {\n if (props.dismiss === 'localstorage') {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n return dismissedObject[props.id ?? props.title] === 'dismissed';\n } catch (error) {\n // nothing\n return false;\n }\n } else {\n return false;\n }\n });\n\n const onClose = React.useMemo<(() => void) | undefined>(() => {\n if (!props.dismiss || props.dismiss === 'none') {\n return undefined;\n } else if (props.dismiss === 'session') {\n return () => setDismissed(true);\n } else if (props.dismiss === 'localstorage') {\n return () => {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n dismissedObject[props.id ?? props.title] = 'dismissed';\n localStorage.setItem(\n 'global-header/NotificationBanner',\n JSON.stringify(dismissedObject),\n );\n } catch (error) {\n // nothing\n }\n setDismissed(true);\n };\n }\n // eslint-disable-next-line no-console\n console.warn(\n `Unsupported dismiss option \"${props.dismiss}\", currently supported \"none\", \"session\" or \"localstorage\"!`,\n );\n return undefined;\n }, [props.id, props.title, props.dismiss]);\n\n if (dismissed || !props.title) {\n return null;\n }\n\n return (\n <Alert\n color=\"warning\"\n icon={props.icon ? <HeaderIcon icon={props.icon} /> : false}\n onClose={onClose}\n sx={{\n color: props.textColor,\n backgroundColor: props.backgroundColor,\n borderColor: props.borderColor,\n borderStyle: 'solid',\n borderWidth: 2,\n borderRadius: 0,\n justifyContent: 'center',\n textAlign: 'center',\n ...props.layout,\n }}\n >\n {props.markdown ? (\n <MarkdownContent content={props.title} dialect=\"gfm\" />\n ) : (\n props.title\n )}\n </Alert>\n );\n};\n"],"names":[],"mappings":";;;;;AA8Ca,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAkB,MAAM;AAC9D,IAAI,IAAA,KAAA,CAAM,YAAY,cAAgB,EAAA;AACpC,MAAI,IAAA;AACF,QAAA,MAAM,eACJ,GAAA,YAAA,CAAa,OAAQ,CAAA,kCAAkC,CAAK,IAAA,IAAA;AAC9D,QAAM,MAAA,eAAA,GAAkB,IAAK,CAAA,KAAA,CAAM,eAAe,CAAA;AAClD,QAAA,OAAO,eAAgB,CAAA,KAAA,CAAM,EAAM,IAAA,KAAA,CAAM,KAAK,CAAM,KAAA,WAAA;AAAA,eAC7C,KAAO,EAAA;AAEd,QAAO,OAAA,KAAA;AAAA;AACT,KACK,MAAA;AACL,MAAO,OAAA,KAAA;AAAA;AACT,GACD,CAAA;AAED,EAAM,MAAA,OAAA,GAAU,KAAM,CAAA,OAAA,CAAkC,MAAM;AAC5D,IAAA,IA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CAAK,GAAA,KAAA;AAAA,MACtD,OAAA;AAAA,MACA,EAAI,EAAA;AAAA,QACF,OAAO,KAAM,CAAA,SAAA;AAAA,QACb,iBAAiB,KAAM,CAAA,eAAA;AAAA,QACvB,aAAa,KAAM,CAAA,WAAA;AAAA,QACnB,WAAa,EAAA,OAAA;AAAA,QACb,WAAa,EAAA,CAAA;AAAA,QACb,YAAc,EAAA,CAAA;AAAA,QACd,cAAgB,EAAA,QAAA;AAAA,QAChB,SAAW,EAAA,QAAA;AAAA,QACX,GAAG,KAAM,CAAA;AAAA;AACX,KAAA;AAAA,IAEC,KAAA,CAAM,QACL,mBAAA,KAAA,CAAA,aAAA,CAAC,eAAgB,EAAA,EAAA,OAAA,EAAS,MAAM,KAAO,EAAA,OAAA,EAAQ,KAAM,EAAA,CAAA,GAErD,KAAM,CAAA;AAAA,GAEV;AAEJ;;;;"}
1
+ {"version":3,"file":"NotificationBanner.esm.js","sources":["../../src/components/NotificationBanner.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 { useState, useMemo } from 'react';\nimport type { CSSProperties } from 'react';\n\nimport { MarkdownContent } from '@backstage/core-components';\n\nimport Alert from '@mui/material/Alert';\n\nimport { HeaderIcon } from './HeaderIcon/HeaderIcon';\n\n/**\n * @public\n */\nexport type NotificationBannerDismiss = 'none' | 'session' | 'localstorage';\n\n/**\n * @public\n */\nexport interface NotificationBannerProps {\n id?: string;\n title: string;\n markdown?: boolean;\n icon?: string;\n\n textColor?: string;\n backgroundColor?: string;\n borderColor?: string;\n layout?: CSSProperties;\n\n dismiss?: NotificationBannerDismiss;\n}\n\nexport const NotificationBanner = (props: NotificationBannerProps) => {\n const [dismissed, setDismissed] = useState<boolean>(() => {\n if (props.dismiss === 'localstorage') {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n return dismissedObject[props.id ?? props.title] === 'dismissed';\n } catch (error) {\n // nothing\n return false;\n }\n } else {\n return false;\n }\n });\n\n const onClose = useMemo<(() => void) | undefined>(() => {\n if (!props.dismiss || props.dismiss === 'none') {\n return undefined;\n } else if (props.dismiss === 'session') {\n return () => setDismissed(true);\n } else if (props.dismiss === 'localstorage') {\n return () => {\n try {\n const dismissedString =\n localStorage.getItem('global-header/NotificationBanner') ?? '{}';\n const dismissedObject = JSON.parse(dismissedString);\n dismissedObject[props.id ?? props.title] = 'dismissed';\n localStorage.setItem(\n 'global-header/NotificationBanner',\n JSON.stringify(dismissedObject),\n );\n } catch (error) {\n // nothing\n }\n setDismissed(true);\n };\n }\n // eslint-disable-next-line no-console\n console.warn(\n `Unsupported dismiss option \"${props.dismiss}\", currently supported \"none\", \"session\" or \"localstorage\"!`,\n );\n return undefined;\n }, [props.id, props.title, props.dismiss]);\n\n if (dismissed || !props.title) {\n return null;\n }\n\n return (\n <Alert\n color=\"warning\"\n icon={props.icon ? <HeaderIcon icon={props.icon} /> : false}\n onClose={onClose}\n sx={{\n color: props.textColor,\n backgroundColor: props.backgroundColor,\n borderColor: props.borderColor,\n borderStyle: 'solid',\n borderWidth: 2,\n borderRadius: 0,\n justifyContent: 'center',\n textAlign: 'center',\n ...props.layout,\n }}\n >\n {props.markdown ? (\n <MarkdownContent content={props.title} dialect=\"gfm\" />\n ) : (\n props.title\n )}\n </Alert>\n );\n};\n"],"names":[],"mappings":";;;;;;AA+Ca,MAAA,kBAAA,GAAqB,CAAC,KAAmC,KAAA;AACpE,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAkB,MAAM;AACx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ACN,CAAA,4BAAA,EAA+B,MAAM,OAAO,CAAA,2DAAA;AAAA,KAC9C;AACA,IAAO,OAAA,KAAA,CAAA;AAAA,GACT,EAAG,CAAC,KAAM,CAAA,EAAA,EAAI,MAAM,KAAO,EAAA,KAAA,CAAM,OAAO,CAAC,CAAA;AAEzC,EAAI,IAAA,SAAA,IAAa,CAAC,KAAA,CAAM,KAAO,EAAA;AAC7B,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,KAAM,EAAA,SAAA;AAAA,MACN,IAAA,EAAM,MAAM,IAAO,mBAAA,GAAA,CAAC,cAAW,IAAM,EAAA,KAAA,CAAM,MAAM,CAAK,GAAA,KAAA;AAAA,MACtD,OAAA;AAAA,MACA,EAAI,EAAA;AAAA,QACF,OAAO,KAAM,CAAA,SAAA;AAAA,QACb,iBAAiB,KAAM,CAAA,eAAA;AAAA,QACvB,aAAa,KAAM,CAAA,WAAA;AAAA,QACnB,WAAa,EAAA,OAAA;AAAA,QACb,WAAa,EAAA,CAAA;AAAA,QACb,YAAc,EAAA,CAAA;AAAA,QACd,cAAgB,EAAA,QAAA;AAAA,QAChB,SAAW,EAAA,QAAA;AAAA,QACX,GAAG,KAAM,CAAA;AAAA,OACX;AAAA,MAEC,QAAA,EAAA,KAAA,CAAM,QACL,mBAAA,GAAA,CAAC,eAAgB,EAAA,EAAA,OAAA,EAAS,MAAM,KAAO,EAAA,OAAA,EAAQ,KAAM,EAAA,CAAA,GAErD,KAAM,CAAA;AAAA;AAAA,GAEV;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import { Link as Link$1 } from '@backstage/core-components';
3
3
  import Badge from '@mui/material/Badge';
4
4
  import Box from '@mui/material/Box';
@@ -7,7 +7,7 @@ import Tooltip from '@mui/material/Tooltip';
7
7
  import NotificationIcon from '@mui/icons-material/NotificationsOutlined';
8
8
  import { useNotificationCount } from '../../hooks/useNotificationCount.esm.js';
9
9
 
10
- const Link = (props) => /* @__PURE__ */ React.createElement(Link$1, { ...props, color: "inherit", externalLinkIcon: false });
10
+ const Link = (props) => /* @__PURE__ */ jsx(Link$1, { ...props, color: "inherit", externalLinkIcon: false });
11
11
  const NotificationButton = ({
12
12
  title = "Notifications",
13
13
  tooltip,
@@ -21,17 +21,17 @@ const NotificationButton = ({
21
21
  if (!available) {
22
22
  return null;
23
23
  }
24
- return /* @__PURE__ */ React.createElement(Box, { sx: layout }, /* @__PURE__ */ React.createElement(Tooltip, { title: tooltip ?? title }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
24
+ return /* @__PURE__ */ jsx(Box, { sx: layout, children: /* @__PURE__ */ jsx(Tooltip, { title: tooltip ?? title, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
25
25
  IconButton,
26
26
  {
27
27
  component: Link,
28
28
  color,
29
29
  size,
30
30
  to,
31
- "aria-label": title
32
- },
33
- unreadCount > 0 ? /* @__PURE__ */ React.createElement(Badge, { badgeContent: unreadCount, color: badgeColor, max: 999 }, /* @__PURE__ */ React.createElement(NotificationIcon, { fontSize: size })) : /* @__PURE__ */ React.createElement(NotificationIcon, { fontSize: size })
34
- ))));
31
+ "aria-label": title,
32
+ children: unreadCount > 0 ? /* @__PURE__ */ jsx(Badge, { badgeContent: unreadCount, color: badgeColor, max: 999, children: /* @__PURE__ */ jsx(NotificationIcon, { fontSize: size }) }) : /* @__PURE__ */ jsx(NotificationIcon, { fontSize: size })
33
+ }
34
+ ) }) }) });
35
35
  };
36
36
 
37
37
  export { NotificationButton };
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationButton.esm.js","sources":["../../../src/components/NotificationButton/NotificationButton.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';\n\nimport { Link as BackstageLink } from '@backstage/core-components';\n\nimport Badge from '@mui/material/Badge';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport NotificationIcon from '@mui/icons-material/NotificationsOutlined';\n\nimport { useNotificationCount } from '../../hooks/useNotificationCount';\n\n/**\n * @public\n */\nexport interface NotificationButtonProps {\n title?: string;\n tooltip?: string;\n color?:\n | 'inherit'\n | 'default'\n | 'primary'\n | 'secondary'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n size?: 'small' | 'medium' | 'large';\n badgeColor?:\n | 'primary'\n | 'secondary'\n | 'default'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n to?: string;\n layout?: React.CSSProperties;\n}\n\n// Backstage Link automatically detects external links and emits analytic events.\nconst Link = (props: any) => (\n <BackstageLink {...props} color=\"inherit\" externalLinkIcon={false} />\n);\n\n/**\n * @public\n */\nexport const NotificationButton = ({\n title = 'Notifications',\n tooltip,\n color = 'inherit',\n size = 'small',\n badgeColor = 'error',\n to = '/notifications',\n layout,\n}: NotificationButtonProps) => {\n const { available, unreadCount } = useNotificationCount();\n\n if (!available) {\n return null;\n }\n\n return (\n <Box sx={layout}>\n <Tooltip title={tooltip ?? title}>\n <div>\n <IconButton\n component={Link}\n color={color}\n size={size}\n to={to}\n aria-label={title}\n >\n {unreadCount > 0 ? (\n <Badge badgeContent={unreadCount} color={badgeColor} max={999}>\n <NotificationIcon fontSize={size} />\n </Badge>\n ) : (\n <NotificationIcon fontSize={size} />\n )}\n </IconButton>\n </div>\n </Tooltip>\n </Box>\n );\n};\n"],"names":["BackstageLink"],"mappings":";;;;;;;;;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["../../../src/components/NotificationButton/NotificationButton.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 type { CSSProperties } from 'react';\nimport { Link as BackstageLink } from '@backstage/core-components';\n\nimport Badge from '@mui/material/Badge';\nimport Box from '@mui/material/Box';\nimport IconButton from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport NotificationIcon from '@mui/icons-material/NotificationsOutlined';\n\nimport { useNotificationCount } from '../../hooks/useNotificationCount';\n\n/**\n * @public\n */\nexport interface NotificationButtonProps {\n title?: string;\n tooltip?: string;\n color?:\n | 'inherit'\n | 'default'\n | 'primary'\n | 'secondary'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n size?: 'small' | 'medium' | 'large';\n badgeColor?:\n | 'primary'\n | 'secondary'\n | 'default'\n | 'error'\n | 'info'\n | 'success'\n | 'warning';\n to?: string;\n layout?: CSSProperties;\n}\n\n// Backstage Link automatically detects external links and emits analytic events.\nconst Link = (props: any) => (\n <BackstageLink {...props} color=\"inherit\" externalLinkIcon={false} />\n);\n\n/**\n * @public\n */\nexport const NotificationButton = ({\n title = 'Notifications',\n tooltip,\n color = 'inherit',\n size = 'small',\n badgeColor = 'error',\n to = '/notifications',\n layout,\n}: NotificationButtonProps) => {\n const { available, unreadCount } = useNotificationCount();\n\n if (!available) {\n return null;\n }\n\n return (\n <Box sx={layout}>\n <Tooltip title={tooltip ?? title}>\n <div>\n <IconButton\n component={Link}\n color={color}\n size={size}\n to={to}\n aria-label={title}\n >\n {unreadCount > 0 ? (\n <Badge badgeContent={unreadCount} color={badgeColor} max={999}>\n <NotificationIcon fontSize={size} />\n </Badge>\n ) : (\n <NotificationIcon fontSize={size} />\n )}\n </IconButton>\n </div>\n </Tooltip>\n </Box>\n );\n};\n"],"names":["BackstageLink"],"mappings":";;;;;;;;;AAwDA,MAAM,IAAA,GAAO,CAAC,KAAA,qBACX,GAAA,CAAAA,MAAA,EAAA,EAAe,GAAG,KAAO,EAAA,KAAA,EAAM,SAAU,EAAA,gBAAA,EAAkB,KAAO,EAAA,CAAA;AAM9D,MAAM,qBAAqB,CAAC;AAAA,EACjC,KAAQ,GAAA,eAAA;AAAA,EACR,OAAA;AAAA,EACA,KAAQ,GAAA,SAAA;AAAA,EACR,IAAO,GAAA,OAAA;AAAA,EACP,UAAa,GAAA,OAAA;AAAA,EACb,EAAK,GAAA,gBAAA;AAAA,EACL;AACF,CAA+B,KAAA;AAC7B,EAAA,MAAM,EAAE,SAAA,EAAW,WAAY,EAAA,GAAI,oBAAqB,EAAA;AAExD,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,MACP,EAAA,QAAA,kBAAA,GAAA,CAAC,WAAQ,KAAO,EAAA,OAAA,IAAW,KACzB,EAAA,QAAA,kBAAA,GAAA,CAAC,KACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,MACX,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA;AAAA,MACA,YAAY,EAAA,KAAA;AAAA,MAEX,wBAAc,CACb,mBAAA,GAAA,CAAC,SAAM,YAAc,EAAA,WAAA,EAAa,OAAO,UAAY,EAAA,GAAA,EAAK,KACxD,QAAC,kBAAA,GAAA,CAAA,gBAAA,EAAA,EAAiB,UAAU,IAAM,EAAA,CAAA,EACpC,oBAEC,GAAA,CAAA,gBAAA,EAAA,EAAiB,UAAU,IAAM,EAAA;AAAA;AAAA,GAEtC,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useRef, useEffect } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useState, useRef, useEffect } from 'react';
2
3
  import { useSearch, SearchResultState } from '@backstage/plugin-search-react';
3
4
  import Autocomplete from '@mui/material/Autocomplete';
4
5
  import { createSearchLink } from '../../utils/stringUtils.esm.js';
@@ -22,7 +23,7 @@ const SearchBar = (props) => {
22
23
  useEffect(() => {
23
24
  highlightedIndexRef.current = highlightedIndex;
24
25
  }, [highlightedIndex]);
25
- return /* @__PURE__ */ React.createElement(SearchResultState, { ...props }, ({ loading, error, value }) => {
26
+ return /* @__PURE__ */ jsx(SearchResultState, { ...props, children: ({ loading, error, value }) => {
26
27
  const results = query?.term ? value?.results ?? [] : [];
27
28
  let options = [];
28
29
  if (query?.term && results.length === 0) {
@@ -35,7 +36,7 @@ const SearchBar = (props) => {
35
36
  ];
36
37
  }
37
38
  const searchLink = createSearchLink(query?.term ?? "");
38
- return /* @__PURE__ */ React.createElement(
39
+ return /* @__PURE__ */ jsx(
39
40
  Autocomplete,
40
41
  {
41
42
  freeSolo: true,
@@ -48,6 +49,8 @@ const SearchBar = (props) => {
48
49
  componentsProps: {
49
50
  paper: {
50
51
  sx: {
52
+ "&:empty": { visibility: "hidden" },
53
+ // Removes underline-like effect
51
54
  borderRadius: "4px",
52
55
  outline: "unset",
53
56
  boxShadow: theme.palette.mode === "dark" ? `0 2px 6px 2px rgba(0, 0, 0, 0.50), 0 1px 2px 0 rgba(0, 0, 0, 0.50)` : "0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.30)"
@@ -75,7 +78,7 @@ const SearchBar = (props) => {
75
78
  setHighlightedIndex(-1);
76
79
  }
77
80
  },
78
- renderInput: (params) => /* @__PURE__ */ React.createElement(
81
+ renderInput: (params) => /* @__PURE__ */ jsx(
79
82
  SearchInput,
80
83
  {
81
84
  params,
@@ -83,7 +86,7 @@ const SearchBar = (props) => {
83
86
  helperText: error ? "Error fetching results" : ""
84
87
  }
85
88
  ),
86
- renderOption: (renderProps, option, { index }) => /* @__PURE__ */ React.createElement(
89
+ renderOption: (renderProps, option, { index }) => /* @__PURE__ */ jsx(
87
90
  SearchOption,
88
91
  {
89
92
  option,
@@ -100,7 +103,7 @@ const SearchBar = (props) => {
100
103
  }
101
104
  }
102
105
  );
103
- });
106
+ } });
104
107
  };
105
108
 
106
109
  export { SearchBar };
@@ -1 +1 @@
1
- {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchComponent/SearchBar.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, { useEffect, useRef, useState } from 'react';\nimport {\n SearchResultState,\n SearchResultProps,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport Autocomplete from '@mui/material/Autocomplete';\nimport { createSearchLink } from '../../utils/stringUtils';\nimport { useNavigate } from 'react-router-dom';\nimport { SearchInput } from './SearchInput';\nimport { SearchOption } from './SearchOption';\nimport { useTheme } from '@mui/material/styles';\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback';\n\ninterface SearchBarProps {\n query: SearchResultProps['query'];\n setSearchTerm: (term: string) => void;\n}\nexport const SearchBar = (props: SearchBarProps) => {\n const { query, setSearchTerm } = props;\n const navigate = useNavigate();\n const theme = useTheme();\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const highlightedIndexRef = useRef(highlightedIndex);\n const { setTerm } = useSearch();\n\n const onInputChange = useDebouncedCallback((_, inputValue) => {\n setSearchTerm(inputValue);\n setTerm(inputValue);\n }, 300);\n\n useEffect(() => {\n highlightedIndexRef.current = highlightedIndex;\n }, [highlightedIndex]);\n\n return (\n <SearchResultState {...props}>\n {({ loading, error, value }) => {\n const results = query?.term ? value?.results ?? [] : [];\n let options: string[] = [];\n if (query?.term && results.length === 0) {\n options = ['No results found'];\n }\n if (results.length > 0) {\n options = [\n ...results.map(result => result.document.title),\n `${query?.term}`,\n ];\n }\n const searchLink = createSearchLink(query?.term ?? '');\n\n return (\n <Autocomplete\n freeSolo\n options={options}\n loading={loading}\n value={query?.term ?? ''}\n getOptionLabel={option => option ?? ''}\n onInputChange={onInputChange}\n onHighlightChange={(_, option) =>\n setHighlightedIndex(options.indexOf(option ?? ''))\n }\n componentsProps={{\n paper: {\n sx: {\n borderRadius: '4px',\n outline: 'unset',\n boxShadow:\n theme.palette.mode === 'dark'\n ? `0 2px 6px 2px rgba(0, 0, 0, 0.50), 0 1px 2px 0 rgba(0, 0, 0, 0.50)`\n : '0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.30)',\n },\n },\n }}\n sx={{\n width: '100%',\n '& [class*=\"MuiAutocomplete-clearIndicator\"]': {\n visibility: query?.term ? 'visible' : 'hidden',\n },\n }}\n filterOptions={x => x}\n onKeyDown={event => {\n const currentHighlight = highlightedIndexRef.current;\n if (event.key === 'Enter') {\n event.preventDefault();\n if (currentHighlight === -1 && query?.term) {\n navigate(searchLink);\n } else if (currentHighlight !== -1) {\n navigate(\n results[highlightedIndex]?.document?.location ?? searchLink,\n );\n }\n setHighlightedIndex(-1);\n }\n }}\n renderInput={params => (\n <SearchInput\n params={params}\n error={!!error}\n helperText={error ? 'Error fetching results' : ''}\n />\n )}\n renderOption={(renderProps, option, { index }) => (\n <SearchOption\n option={option}\n index={index}\n options={options}\n query={query}\n results={results}\n renderProps={renderProps}\n searchLink={searchLink}\n />\n )}\n List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AA,EAAO,IAAM,EAAA;AAC1C,cAAA,QAAA,CAAS,UAAU,CAAA;AAAA,aACrB,MAAA,IAAW,qBAAqB,CAAI,CAAA,EAAA;AAClC,cAAA,QAAA;AAAA,gBACE,OAAQ,CAAA,gBAAgB,CAAG,EAAA,QAAA,EAAU,QAAY,IAAA;AAAA,eACnD;AAAA;AAEF,YAAA,mBAAA,CAAoB,CAAE,CAAA,CAAA;AAAA;AACxB,SACF;AAAA,QACA,aAAa,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,WAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,KAAA,EAAO,CAAC,CAAC,KAAA;AAAA,YACT,UAAA,EAAY,QAAQ,wBAA2B,GAAA;AAAA;AAAA,SACjD;AAAA,QAEF,cAAc,CAAC,WAAA,EAAa,MAAQ,EAAA,EAAE,OACpC,qBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,YAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,KAAA;AAAA,YACA,OAAA;AAAA,YACA,KAAA;AAAA,YACA,OAAA;AAAA,YACA,WAAA;AAAA,YACA;AAAA;AAAA,SACF;AAAA,QAEF,YAAc,EAAA;AAAA,UACZ,EAAA,EAAI,EAAE,SAAA,EAAW,MAAO;AAAA;AAC1B;AAAA,KACF;AAAA,GAGN,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SearchBar.esm.js","sources":["../../../src/components/SearchComponent/SearchBar.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 { useEffect, useRef, useState } from 'react';\nimport {\n SearchResultState,\n SearchResultProps,\n useSearch,\n} from '@backstage/plugin-search-react';\nimport Autocomplete from '@mui/material/Autocomplete';\nimport { createSearchLink } from '../../utils/stringUtils';\nimport { useNavigate } from 'react-router-dom';\nimport { SearchInput } from './SearchInput';\nimport { SearchOption } from './SearchOption';\nimport { useTheme } from '@mui/material/styles';\nimport { useDebouncedCallback } from '../../hooks/useDebouncedCallback';\n\ninterface SearchBarProps {\n query: SearchResultProps['query'];\n setSearchTerm: (term: string) => void;\n}\nexport const SearchBar = (props: SearchBarProps) => {\n const { query, setSearchTerm } = props;\n const navigate = useNavigate();\n const theme = useTheme();\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const highlightedIndexRef = useRef(highlightedIndex);\n const { setTerm } = useSearch();\n\n const onInputChange = useDebouncedCallback((_, inputValue) => {\n setSearchTerm(inputValue);\n setTerm(inputValue);\n }, 300);\n\n useEffect(() => {\n highlightedIndexRef.current = highlightedIndex;\n }, [highlightedIndex]);\n\n return (\n <SearchResultState {...props}>\n {({ loading, error, value }) => {\n const results = query?.term ? value?.results ?? [] : [];\n let options: string[] = [];\n if (query?.term && results.length === 0) {\n options = ['No results found'];\n }\n if (results.length > 0) {\n options = [\n ...results.map(result => result.document.title),\n `${query?.term}`,\n ];\n }\n const searchLink = createSearchLink(query?.term ?? '');\n\n return (\n <Autocomplete\n freeSolo\n options={options}\n loading={loading}\n value={query?.term ?? ''}\n getOptionLabel={option => option ?? ''}\n onInputChange={onInputChange}\n onHighlightChange={(_, option) =>\n setHighlightedIndex(options.indexOf(option ?? ''))\n }\n componentsProps={{\n paper: {\n sx: {\n '&:empty': { visibility: 'hidden' }, // Removes underline-like effect\n borderRadius: '4px',\n outline: 'unset',\n boxShadow:\n theme.palette.mode === 'dark'\n ? `0 2px 6px 2px rgba(0, 0, 0, 0.50), 0 1px 2px 0 rgba(0, 0, 0, 0.50)`\n : '0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.30)',\n },\n },\n }}\n sx={{\n width: '100%',\n '& [class*=\"MuiAutocomplete-clearIndicator\"]': {\n visibility: query?.term ? 'visible' : 'hidden',\n },\n }}\n filterOptions={x => x}\n onKeyDown={event => {\n const currentHighlight = highlightedIndexRef.current;\n if (event.key === 'Enter') {\n event.preventDefault();\n if (currentHighlight === -1 && query?.term) {\n navigate(searchLink);\n } else if (currentHighlight !== -1) {\n navigate(\n results[highlightedIndex]?.document?.location ?? searchLink,\n );\n }\n setHighlightedIndex(-1);\n }\n }}\n renderInput={params => (\n <SearchInput\n params={params}\n error={!!error}\n helperText={error ? 'Error fetching results' : ''}\n />\n )}\n renderOption={(renderProps, option, { index }) => (\n <SearchOption\n option={option}\n index={index}\n options={options}\n query={query}\n results={results}\n renderProps={renderProps}\n searchLink={searchLink}\n />\n )}\n ListboxProps={{\n sx: { maxHeight: '60vh' },\n }}\n />\n );\n }}\n </SearchResultState>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAkCa,MAAA,SAAA,GAAY,CAAC,KAA0B,KAAA;AAClD,EAAM,MAAA,EAAE,KAAO,EAAA,aAAA,EAAkB,GAAA,KAAA;AACjC,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,CAAE,CAAA,CAAA;AAC3D,EAAM,MAAA,mBAAA,GAAsB,OAAO,gBAAgB,CAAA;AACnD,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,SAAU,EAAA;AAE9B,EAAA,MAAM,aAAgB,GAAA,oBAAA,CAAqB,CAAC,CAAA,EAAG,UAAe,KAAA;AAC5D,IAAA,aAAA,CAAc,UAAU,CAAA;AACxB,IAAA,OAAA,CAAQ,UAAU,CAAA;AAAA,KACjB,GAAG,CAAA;AAEN,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,mBAAA,CAAoB,OAAU,G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AAA,YACA;AAAA;AAAA,SACF;AAAA,QAEF,YAAc,EAAA;AAAA,UACZ,EAAA,EAAI,EAAE,SAAA,EAAW,MAAO;AAAA;AAC1B;AAAA,KACF;AAAA,GAGN,EAAA,CAAA;AAEJ;;;;"}
@@ -1,11 +1,12 @@
1
- import React, { useState } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useState } from 'react';
2
3
  import Box from '@mui/material/Box';
3
4
  import { SearchBar } from './SearchBar.esm.js';
4
5
  import { SearchContextProvider } from '@backstage/plugin-search-react';
5
6
 
6
7
  const SearchComponent = () => {
7
8
  const [searchTerm, setSearchTerm] = useState("");
8
- return /* @__PURE__ */ React.createElement(SearchContextProvider, null, /* @__PURE__ */ React.createElement(
9
+ return /* @__PURE__ */ jsx(SearchContextProvider, { children: /* @__PURE__ */ jsx(
9
10
  Box,
10
11
  {
11
12
  sx: {
@@ -15,10 +16,10 @@ const SearchComponent = () => {
15
16
  flexDirection: "row",
16
17
  justifyContent: "start",
17
18
  direction: "ltr"
18
- }
19
- },
20
- /* @__PURE__ */ React.createElement(SearchBar, { query: { term: searchTerm }, setSearchTerm })
21
- ));
19
+ },
20
+ children: /* @__PURE__ */ jsx(SearchBar, { query: { term: searchTerm }, setSearchTerm })
21
+ }
22
+ ) });
22
23
  };
23
24
 
24
25
  export { SearchComponent };