@red-hat-developer-hub/backstage-plugin-global-header 1.7.3 → 1.9.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/app-config.dynamic.yaml +8 -1
  3. package/config.d.ts +31 -0
  4. package/dist/components/CompanyLogo/CompanyLogo.esm.js +64 -0
  5. package/dist/components/CompanyLogo/CompanyLogo.esm.js.map +1 -0
  6. package/dist/components/CompanyLogo/DefaultLogo.esm.js +237 -0
  7. package/dist/components/CompanyLogo/DefaultLogo.esm.js.map +1 -0
  8. package/dist/components/Divider/Divider.esm.js +2 -2
  9. package/dist/components/Divider/Divider.esm.js.map +1 -1
  10. package/dist/components/GlobalHeader.esm.js +2 -2
  11. package/dist/components/GlobalHeader.esm.js.map +1 -1
  12. package/dist/components/GlobalHeaderComponent.esm.js +13 -12
  13. package/dist/components/GlobalHeaderComponent.esm.js.map +1 -1
  14. package/dist/components/HeaderButton/HeaderButton.esm.js +9 -9
  15. package/dist/components/HeaderButton/HeaderButton.esm.js.map +1 -1
  16. package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js +29 -28
  17. package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js.map +1 -1
  18. package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js +17 -13
  19. package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js.map +1 -1
  20. package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js +16 -14
  21. package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js.map +1 -1
  22. package/dist/components/HeaderDropdownComponent/HeaderDropdownComponent.esm.js +32 -28
  23. package/dist/components/HeaderDropdownComponent/HeaderDropdownComponent.esm.js.map +1 -1
  24. package/dist/components/HeaderDropdownComponent/MenuSection.esm.js +55 -48
  25. package/dist/components/HeaderDropdownComponent/MenuSection.esm.js.map +1 -1
  26. package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js +38 -31
  27. package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js.map +1 -1
  28. package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js +2 -2
  29. package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js.map +1 -1
  30. package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js +15 -11
  31. package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js.map +1 -1
  32. package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js +55 -50
  33. package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js.map +1 -1
  34. package/dist/components/HeaderIcon/HeaderIcon.esm.js +11 -11
  35. package/dist/components/HeaderIcon/HeaderIcon.esm.js.map +1 -1
  36. package/dist/components/HeaderIconButton/HeaderIconButton.esm.js +7 -7
  37. package/dist/components/HeaderIconButton/HeaderIconButton.esm.js.map +1 -1
  38. package/dist/components/LogoutButton/LogoutButton.esm.js +5 -5
  39. package/dist/components/LogoutButton/LogoutButton.esm.js.map +1 -1
  40. package/dist/components/MenuItemLink/MenuItemLink.esm.js +6 -3
  41. package/dist/components/MenuItemLink/MenuItemLink.esm.js.map +1 -1
  42. package/dist/components/MenuItemLink/MenuItemLinkContent.esm.js +46 -39
  43. package/dist/components/MenuItemLink/MenuItemLinkContent.esm.js.map +1 -1
  44. package/dist/components/NotificationBanner.esm.js +9 -8
  45. package/dist/components/NotificationBanner.esm.js.map +1 -1
  46. package/dist/components/NotificationButton/NotificationButton.esm.js +7 -7
  47. package/dist/components/NotificationButton/NotificationButton.esm.js.map +1 -1
  48. package/dist/components/SearchComponent/SearchBar.esm.js +7 -6
  49. package/dist/components/SearchComponent/SearchBar.esm.js.map +1 -1
  50. package/dist/components/SearchComponent/SearchComponent.esm.js +7 -6
  51. package/dist/components/SearchComponent/SearchComponent.esm.js.map +1 -1
  52. package/dist/components/SearchComponent/SearchInput.esm.js +3 -3
  53. package/dist/components/SearchComponent/SearchInput.esm.js.map +1 -1
  54. package/dist/components/SearchComponent/SearchOption.esm.js +19 -13
  55. package/dist/components/SearchComponent/SearchOption.esm.js.map +1 -1
  56. package/dist/components/SearchComponent/SearchResultItem.esm.js +18 -18
  57. package/dist/components/SearchComponent/SearchResultItem.esm.js.map +1 -1
  58. package/dist/components/Spacer/Spacer.esm.js +2 -2
  59. package/dist/components/Spacer/Spacer.esm.js.map +1 -1
  60. package/dist/components/SupportButton/SupportButton.esm.js +17 -17
  61. package/dist/components/SupportButton/SupportButton.esm.js.map +1 -1
  62. package/dist/defaultMountPoints/defaultMountPoints.esm.js +11 -0
  63. package/dist/defaultMountPoints/defaultMountPoints.esm.js.map +1 -1
  64. package/dist/hooks/useDebouncedCallback.esm.js +4 -4
  65. package/dist/hooks/useDebouncedCallback.esm.js.map +1 -1
  66. package/dist/hooks/useDropdownManager.esm.js +2 -2
  67. package/dist/hooks/useDropdownManager.esm.js.map +1 -1
  68. package/dist/index.d.ts +51 -36
  69. package/dist/index.esm.js +1 -1
  70. package/dist/plugin.esm.js +11 -2
  71. package/dist/plugin.esm.js.map +1 -1
  72. package/dist/utils/stringUtils.esm.js +12 -12
  73. package/dist/utils/stringUtils.esm.js.map +1 -1
  74. package/package.json +28 -25
@@ -1,4 +1,5 @@
1
- import React, { useMemo } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
2
3
  import AppsIcon from '@mui/icons-material/Apps';
3
4
  import AppRegistrationIcon from '@mui/icons-material/AppRegistration';
4
5
  import { useApplicationLauncherDropdownMountPoints } from '../../hooks/useApplicationLauncherDropdownMountPoints.esm.js';
@@ -34,42 +35,42 @@ const ApplicationLauncherDropdown = () => {
34
35
  return groupedSections;
35
36
  }, [mountPoints]);
36
37
  const sections = Object.entries(sectionsObject);
37
- return /* @__PURE__ */ React.createElement(
38
+ return /* @__PURE__ */ jsx(
38
39
  HeaderDropdownComponent,
39
40
  {
40
- buttonContent: /* @__PURE__ */ React.createElement(AppsIcon, null),
41
+ buttonContent: /* @__PURE__ */ jsx(AppsIcon, {}),
41
42
  tooltip: "Application launcher",
42
43
  isIconButton: true,
43
44
  onOpen: handleOpen,
44
45
  onClose: handleClose,
45
- anchorEl
46
- },
47
- sections.length > 0 ? sections.map(
48
- ([section, { sectionLink, sectionLinkLabel, items }], index) => /* @__PURE__ */ React.createElement(
49
- MenuSection,
46
+ anchorEl,
47
+ children: sections.length > 0 ? sections.map(
48
+ ([section, { sectionLink, sectionLinkLabel, items }], index) => /* @__PURE__ */ jsx(
49
+ MenuSection,
50
+ {
51
+ sectionLabel: section,
52
+ optionalLink: sectionLink,
53
+ optionalLinkLabel: sectionLinkLabel,
54
+ items,
55
+ handleClose,
56
+ hideDivider: index === sections.length - 1
57
+ },
58
+ section
59
+ )
60
+ ) : /* @__PURE__ */ jsx(
61
+ DropdownEmptyState,
50
62
  {
51
- key: section,
52
- sectionLabel: section,
53
- optionalLink: sectionLink,
54
- optionalLinkLabel: sectionLinkLabel,
55
- items,
56
- handleClose,
57
- hideDivider: index === sections.length - 1
63
+ title: "No application links configured",
64
+ subTitle: "Configure application links in dynamic plugin config for quick access from here.",
65
+ icon: /* @__PURE__ */ jsx(
66
+ AppRegistrationIcon,
67
+ {
68
+ sx: { fontSize: 64, color: "text.disabled" }
69
+ }
70
+ )
58
71
  }
59
72
  )
60
- ) : /* @__PURE__ */ React.createElement(
61
- DropdownEmptyState,
62
- {
63
- title: "No application links configured",
64
- subTitle: "Configure application links in dynamic plugin config for quick access from here.",
65
- icon: /* @__PURE__ */ React.createElement(
66
- AppRegistrationIcon,
67
- {
68
- sx: { fontSize: 64, color: "text.disabled" }
69
- }
70
- )
71
- }
72
- )
73
+ }
73
74
  );
74
75
  };
75
76
 
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationLauncherDropdown.esm.js","sources":["../../../src/components/HeaderDropdownComponent/ApplicationLauncherDropdown.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, { useMemo } from 'react';\n\nimport AppsIcon from '@mui/icons-material/Apps';\nimport AppRegistrationIcon from '@mui/icons-material/AppRegistration';\n\nimport { useApplicationLauncherDropdownMountPoints } from '../../hooks/useApplicationLauncherDropdownMountPoints';\nimport { useDropdownManager } from '../../hooks';\nimport { HeaderDropdownComponent } from './HeaderDropdownComponent';\nimport { MenuSection } from './MenuSection';\nimport { DropdownEmptyState } from './DropdownEmptyState';\n\nexport const ApplicationLauncherDropdown = () => {\n const { anchorEl, handleOpen, handleClose } = useDropdownManager();\n\n const mountPoints = useApplicationLauncherDropdownMountPoints();\n\n const sectionsObject = useMemo(() => {\n const groupedSections: Record<\n string,\n { sectionLink?: string; sectionLinkLabel?: string; items: any[] }\n > = {};\n\n (mountPoints ?? []).forEach(mp => {\n const section = mp.config?.section ?? '';\n const sectionLink = mp.config?.sectionLink ?? '';\n const sectionLinkLabel = mp.config?.sectionLinkLabel ?? '';\n\n if (!groupedSections[section]) {\n groupedSections[section] = { sectionLink, sectionLinkLabel, items: [] };\n }\n groupedSections[section].items.push({\n Component: mp.Component,\n icon: mp.config?.props?.icon,\n label: mp.config?.props?.title,\n link: mp.config?.props?.link,\n external: mp.config?.props?.external ?? false,\n priority: mp.config?.priority ?? 0,\n });\n });\n\n Object.values(groupedSections).forEach(section => {\n section.items.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n });\n\n return groupedSections;\n }, [mountPoints]);\n\n const sections = Object.entries(sectionsObject);\n\n return (\n <HeaderDropdownComponent\n buttonContent={<AppsIcon />}\n tooltip=\"Application launcher\"\n isIconButton\n onOpen={handleOpen}\n onClose={handleClose}\n anchorEl={anchorEl}\n >\n {sections.length > 0 ? (\n sections.map(\n ([section, { sectionLink, sectionLinkLabel, items }], index) => (\n <MenuSection\n key={section}\n sectionLabel={section}\n optionalLink={sectionLink}\n optionalLinkLabel={sectionLinkLabel}\n items={items}\n handleClose={handleClose}\n hideDivider={index === sections.length - 1}\n />\n ),\n )\n ) : (\n <DropdownEmptyState\n title=\"No application links configured\"\n subTitle=\"Configure application links in dynamic plugin config for quick access from here.\"\n icon={\n <AppRegistrationIcon\n sx={{ fontSize: 64, color: 'text.disabled' }}\n />\n }\n />\n )}\n </HeaderDropdownComponent>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AA0BO,MAAM,8BAA8B,MAAM;AAC/C,EAAA,MAAM,EAAE,QAAA,EAAU,UAAY,EAAA,WAAA,KAAgB,kBAAmB,EAAA;AAEjE,EAAA,MAAM,cAAc,yCAA0C,EAAA;AAE9D,EAAM,MAAA,cAAA,GAAiB,QAAQ,MAAM;AACnC,IAAA,MAAM,kBAGF,EAAC;AAEL,IAAA,CAAC,WAAe,IAAA,EAAI,EAAA,OAAA,CAAQ,CAAM,EAAA,KAAA;AAChC,MAAM,MAAA,OAAA,GAAU,EAAG,CAAA,MAAA,EAAQ,OAAW,IAAA,EAAA;AACtC,MAAM,MAAA,WAAA,GAAc,EAAG,CAAA,MAAA,EAAQ,WAAe,IAAA,EAAA;AAC9C,MAAM,MAAA,gBAAA,GAAmB,EAAG,CAAA,MAAA,EAAQ,gBAAoB,IAAA,EAAA;AAExD,MAAI,IAAA,CAAC,eAAgB,CAAA,OAAO,CAAG,EAAA;AAC7B,QAAA,eAAA,CAAgB,OAAO,CAAI,GAAA,EAAE,aAAa,gBAAkB,EAAA,KAAA,EAAO,EAAG,EAAA;AAAA;AAExE,MAAgB,eAAA,CAAA,OAAO,CAAE,CAAA,KAAA,CAAM,IAAK,CAAA;AAAA,QAClC,WAAW,EAAG,CAAA,SAAA;AAAA,QACd,IAAA,EAAM,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GAAK,EAAA,OAAA;AAAA,UACL,YAAc,EAAA,OAAA;AAAA,UACd,YAAc,EAAA,WAAA;AAAA,UACd,iBAAmB,EAAA,gBAAA;AAAA,UACnB,KAAA;AAAA,UACA,WAAA;AAAA,UACA,WAAA,EAAa,KAAU,KAAA,QAAA,CAAS,MAAS,GAAA;AAAA;AAAA;AAC3C,KAIJ,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,iCAAA;AAAA,QACN,QAAS,EAAA,kFAAA;AAAA,QACT,IACE,kBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,mBAAA;AAAA,UAAA;AAAA,YACC,EAAI,EAAA,EAAE,QAAU,EAAA,EAAA,EAAI,OAAO,eAAgB;AAAA;AAAA;AAC7C;AAAA;AAEJ,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"ApplicationLauncherDropdown.esm.js","sources":["../../../src/components/HeaderDropdownComponent/ApplicationLauncherDropdown.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 { useMemo } from 'react';\n\nimport AppsIcon from '@mui/icons-material/Apps';\nimport AppRegistrationIcon from '@mui/icons-material/AppRegistration';\n\nimport { useApplicationLauncherDropdownMountPoints } from '../../hooks/useApplicationLauncherDropdownMountPoints';\nimport { useDropdownManager } from '../../hooks';\nimport { HeaderDropdownComponent } from './HeaderDropdownComponent';\nimport { MenuSection } from './MenuSection';\nimport { DropdownEmptyState } from './DropdownEmptyState';\n\nexport const ApplicationLauncherDropdown = () => {\n const { anchorEl, handleOpen, handleClose } = useDropdownManager();\n\n const mountPoints = useApplicationLauncherDropdownMountPoints();\n\n const sectionsObject = useMemo(() => {\n const groupedSections: Record<\n string,\n { sectionLink?: string; sectionLinkLabel?: string; items: any[] }\n > = {};\n\n (mountPoints ?? []).forEach(mp => {\n const section = mp.config?.section ?? '';\n const sectionLink = mp.config?.sectionLink ?? '';\n const sectionLinkLabel = mp.config?.sectionLinkLabel ?? '';\n\n if (!groupedSections[section]) {\n groupedSections[section] = { sectionLink, sectionLinkLabel, items: [] };\n }\n groupedSections[section].items.push({\n Component: mp.Component,\n icon: mp.config?.props?.icon,\n label: mp.config?.props?.title,\n link: mp.config?.props?.link,\n external: mp.config?.props?.external ?? false,\n priority: mp.config?.priority ?? 0,\n });\n });\n\n Object.values(groupedSections).forEach(section => {\n section.items.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n });\n\n return groupedSections;\n }, [mountPoints]);\n\n const sections = Object.entries(sectionsObject);\n\n return (\n <HeaderDropdownComponent\n buttonContent={<AppsIcon />}\n tooltip=\"Application launcher\"\n isIconButton\n onOpen={handleOpen}\n onClose={handleClose}\n anchorEl={anchorEl}\n >\n {sections.length > 0 ? (\n sections.map(\n ([section, { sectionLink, sectionLinkLabel, items }], index) => (\n <MenuSection\n key={section}\n sectionLabel={section}\n optionalLink={sectionLink}\n optionalLinkLabel={sectionLinkLabel}\n items={items}\n handleClose={handleClose}\n hideDivider={index === sections.length - 1}\n />\n ),\n )\n ) : (\n <DropdownEmptyState\n title=\"No application links configured\"\n subTitle=\"Configure application links in dynamic plugin config for quick access from here.\"\n icon={\n <AppRegistrationIcon\n sx={{ fontSize: 64, color: 'text.disabled' }}\n />\n }\n />\n )}\n </HeaderDropdownComponent>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AA0BO,MAAM,8BAA8B,MAAM;AAC/C,EAAA,MAAM,EAAE,QAAA,EAAU,UAAY,EAAA,WAAA,KAAgB,kBAAmB,EAAA;AAEjE,EAAA,MAAM,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'react/jsx-runtime';
2
+ import { useMemo } from 'react';
2
3
  import ArrowDropDownOutlinedIcon from '@mui/icons-material/ArrowDropDownOutlined';
3
4
  import { useCreateDropdownMountPoints } from '../../hooks/useCreateDropdownMountPoints.esm.js';
4
5
  import { useDropdownManager } from '../../hooks/useDropdownManager.esm.js';
@@ -17,10 +18,13 @@ const CreateDropdown = ({ layout }) => {
17
18
  if (menuSections.length === 0) {
18
19
  return null;
19
20
  }
20
- return /* @__PURE__ */ React.createElement(
21
+ return /* @__PURE__ */ jsx(
21
22
  HeaderDropdownComponent,
22
23
  {
23
- buttonContent: /* @__PURE__ */ React.createElement(Box, { sx: { display: "flex", alignItems: "center" } }, "Self-service ", /* @__PURE__ */ React.createElement(ArrowDropDownOutlinedIcon, { sx: { ml: 1 } })),
24
+ buttonContent: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
25
+ "Self-service ",
26
+ /* @__PURE__ */ jsx(ArrowDropDownOutlinedIcon, { sx: { ml: 1 } })
27
+ ] }),
24
28
  buttonProps: {
25
29
  variant: "outlined",
26
30
  sx: {
@@ -30,16 +34,16 @@ const CreateDropdown = ({ layout }) => {
30
34
  },
31
35
  onOpen: handleOpen,
32
36
  onClose: handleClose,
33
- anchorEl
34
- },
35
- menuSections.map((section, index) => /* @__PURE__ */ React.createElement(
36
- section.Component,
37
- {
38
- key: `menu-section-${index.toString()}`,
39
- hideDivider: index === menuSections.length - 1,
40
- handleClose
41
- }
42
- ))
37
+ anchorEl,
38
+ children: menuSections.map((section, index) => /* @__PURE__ */ jsx(
39
+ section.Component,
40
+ {
41
+ hideDivider: index === menuSections.length - 1,
42
+ handleClose
43
+ },
44
+ `menu-section-${index.toString()}`
45
+ ))
46
+ }
43
47
  );
44
48
  };
45
49
 
@@ -1 +1 @@
1
- {"version":3,"file":"CreateDropdown.esm.js","sources":["../../../src/components/HeaderDropdownComponent/CreateDropdown.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, { useMemo } from 'react';\n\nimport ArrowDropDownOutlinedIcon from '@mui/icons-material/ArrowDropDownOutlined';\n\nimport { MenuItemConfig } from './MenuSection';\nimport { useCreateDropdownMountPoints } from '../../hooks/useCreateDropdownMountPoints';\nimport { useDropdownManager } from '../../hooks';\nimport { HeaderDropdownComponent } from './HeaderDropdownComponent';\nimport Box from '@mui/material/Box';\n\n/**\n * @public\n * Props for each dropdown section component\n */\ninterface SectionComponentProps {\n handleClose: () => void;\n hideDivider: boolean;\n items?: MenuItemConfig[];\n}\n\n/**\n * @public\n * Props for Create Dropdown\n */\nexport interface CreateDropdownProps {\n layout?: React.CSSProperties;\n}\n\nexport const CreateDropdown = ({ layout }: CreateDropdownProps) => {\n const { anchorEl, handleOpen, handleClose } = useDropdownManager();\n\n const createDropdownMountPoints = useCreateDropdownMountPoints();\n\n const menuSections = useMemo(() => {\n return (createDropdownMountPoints ?? [])\n .map(mp => ({\n Component: mp.Component as React.ComponentType<SectionComponentProps>,\n priority: mp.config?.priority ?? 0,\n }))\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }, [createDropdownMountPoints]);\n\n if (menuSections.length === 0) {\n return null;\n }\n\n return (\n <HeaderDropdownComponent\n buttonContent={\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n Self-service <ArrowDropDownOutlinedIcon sx={{ ml: 1 }} />\n </Box>\n }\n buttonProps={{\n variant: 'outlined',\n sx: {\n color: 'inherit',\n ...layout,\n },\n }}\n onOpen={handleOpen}\n onClose={handleClose}\n anchorEl={anchorEl}\n >\n {menuSections.map((section, index) => (\n <section.Component\n key={`menu-section-${index.toString()}`}\n hideDivider={index === menuSections.length - 1}\n handleClose={handleClose}\n />\n ))}\n </HeaderDropdownComponent>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA4CO,MAAM,cAAiB,GAAA,CAAC,EAAE,MAAA,EAAkC,KAAA;AACjE,EAAA,MAAM,EAAE,QAAA,EAAU,UAAY,EAAA,WAAA,KAAgB,kBAAmB,EAAA;AAEjE,EAAA,MAAM,4BAA4B,4BAA6B,EAAA;AAE/D,EAAM,MAAA,YAAA,GAAe,QAAQ,MAAM;AACjC,IAAA,OAAA,CAAQ,yBAA6B,IAAA,EAClC,EAAA,GAAA,CAAI,CAAO,EAAA,MAAA;AAAA,MACV,WAAW,EAAG,CAAA,SAAA;AAAA,MACd,QAAA,EAAU,EAAG,CAAA,MAAA,EAAQ,QAAY,IAAA;AAAA,KACnC,CAAE,CACD,CAAA,IAAA,CAAK,CAAC,CAAA,EAAG,CAAO,KAAA,CAAA,CAAA,CAAE,QAAY,IAAA,CAAA,KAAM,CAAE,CAAA,QAAA,IAAY,CAAE,CAAA,CAAA;AAAA,GACzD,EAAG,CAAC,yBAAyB,CAAC,CAAA;AAE9B,EAAI,IAAA,YAAA,CAAa,WAAW,CAAG,EAAA;AAC7B,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,+BACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,IAAI,EAAE,OAAA,EAAS,QAAQ,UAAY,EAAA,QAAA,EAAY,EAAA,EAAA,eAAA,sCACpC,yBAA0B,EAAA,EAAA,EAAA,EAAI,EAAE,EAAI,EAAA,CAAA,IAAK,CACzD,CAAA;AAAA,MAEF,WAAa,EAAA;AAAA,QACX,OAAS,EAAA,UAAA;AAAA,QACT,EAAI,EAAA;AAAA,UACF,KAAO,EAAA,SAAA;AAAA,UACP,GAAG;AAAA;AACL,OACF;AAAA,MACA,MAAQ,EAAA,UAAA;AAAA,MACR,OAAS,EAAA,WAAA;AAAA,MACT;AAAA,KAAA;AAAA,IAEC,YAAa,CAAA,GAAA,CAAI,CAAC,OAAA,EAAS,KAC1B,qBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,OAAQ,CAAA,SAAA;AAAA,MAAR;AAAA,QACC,GAAK,EAAA,CAAA,aAAA,EAAgB,KAAM,CAAA,QAAA,EAAU,CAAA,CAAA;AAAA,QACrC,WAAA,EAAa,KAAU,KAAA,YAAA,CAAa,MAAS,GAAA,CAAA;AAAA,QAC7C;AAAA;AAAA,KAEH;AAAA,GACH;AAEJ;;;;"}
1
+ {"version":3,"file":"CreateDropdown.esm.js","sources":["../../../src/components/HeaderDropdownComponent/CreateDropdown.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 { useMemo } from 'react';\nimport type { CSSProperties, ComponentType } from 'react';\n\nimport ArrowDropDownOutlinedIcon from '@mui/icons-material/ArrowDropDownOutlined';\n\nimport { MenuItemConfig } from './MenuSection';\nimport { useCreateDropdownMountPoints } from '../../hooks/useCreateDropdownMountPoints';\nimport { useDropdownManager } from '../../hooks';\nimport { HeaderDropdownComponent } from './HeaderDropdownComponent';\nimport Box from '@mui/material/Box';\n\n/**\n * @public\n * Props for each dropdown section component\n */\ninterface SectionComponentProps {\n handleClose: () => void;\n hideDivider: boolean;\n items?: MenuItemConfig[];\n}\n\n/**\n * @public\n * Props for Create Dropdown\n */\nexport interface CreateDropdownProps {\n layout?: CSSProperties;\n}\n\nexport const CreateDropdown = ({ layout }: CreateDropdownProps) => {\n const { anchorEl, handleOpen, handleClose } = useDropdownManager();\n\n const createDropdownMountPoints = useCreateDropdownMountPoints();\n\n const menuSections = useMemo(() => {\n return (createDropdownMountPoints ?? [])\n .map(mp => ({\n Component: mp.Component as ComponentType<SectionComponentProps>,\n priority: mp.config?.priority ?? 0,\n }))\n .sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0));\n }, [createDropdownMountPoints]);\n\n if (menuSections.length === 0) {\n return null;\n }\n\n return (\n <HeaderDropdownComponent\n buttonContent={\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n Self-service <ArrowDropDownOutlinedIcon sx={{ ml: 1 }} />\n </Box>\n }\n buttonProps={{\n variant: 'outlined',\n sx: {\n color: 'inherit',\n ...layout,\n },\n }}\n onOpen={handleOpen}\n onClose={handleClose}\n anchorEl={anchorEl}\n >\n {menuSections.map((section, index) => (\n <section.Component\n key={`menu-section-${index.toString()}`}\n hideDivider={index === menuSections.length - 1}\n handleClose={handleClose}\n />\n ))}\n </HeaderDropdownComponent>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA6CO,MAAM,cAAiB,GAAA,CAAC,EAAE,MAAA,EAAkC,KAAA;AACjE,EAAA,MAAM,EAAE,QAAA,EAAU,UAAY,EAAA,WAAA,KAAgB,kBAAmB,EAAA;AAEjE,EAAA,MAAM,4BAA4B,4BAA6B,EAAA;AAE/D,EAAM,MAAA,YAAA,GAAe,QAAQ,MAAM;AACjC,IAAA,OAAA,CAAQ,yBAA6B,IAAA,EAClC,EAAA,GAAA,CAAI,CAAO,EAAA,MAAA;AAAA,MACV,WAAW,EAAG,CAAA,SAAA;AAAA,MACd,QAAA,EAAU,EAAG,CAAA,MAAA,EAAQ,QAAY,IAAA;AAAA,KACnC,CAAE,CACD,CAAA,IAAA,CAAK,CAAC,CAAA,EAAG,CAAO,KAAA,CAAA,CAAA,CAAE,QAAY,IAAA,CAAA,KAAM,CAAE,CAAA,QAAA,IAAY,CAAE,CAAA,CAAA;AAAA,GACzD,EAAG,CAAC,yBAAyB,CAAC,CAAA;AAE9B,EAAI,IAAA,YAAA,CAAa,WAAW,CAAG,EAAA;AAC7B,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,uBAAA,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,aAAA,uBACG,GAAI,EAAA,EAAA,EAAA,EAAI,EAAE,OAAS,EAAA,MAAA,EAAQ,UAAY,EAAA,QAAA,EAAY,EAAA,QAAA,EAAA;AAAA,QAAA,eAAA;AAAA,4BACpC,yBAA0B,EAAA,EAAA,EAAA,EAAI,EAAE,EAAA,EAAI,GAAK,EAAA;AAAA,OACzD,EAAA,CAAA;AAAA,MAEF,WAAa,EAAA;AAAA,QACX,OAAS,EAAA,UAAA;AAAA,QACT,EAAI,EAAA;AAAA,UACF,KAAO,EAAA,SAAA;AAAA,UACP,GAAG;AAAA;AACL,OACF;AAAA,MACA,MAAQ,EAAA,UAAA;AAAA,MACR,OAAS,EAAA,WAAA;AAAA,MACT,QAAA;AAAA,MAEC,QAAa,EAAA,YAAA,CAAA,GAAA,CAAI,CAAC,OAAA,EAAS,KAC1B,qBAAA,GAAA;AAAA,QAAC,OAAQ,CAAA,SAAA;AAAA,QAAR;AAAA,UAEC,WAAA,EAAa,KAAU,KAAA,YAAA,CAAa,MAAS,GAAA,CAAA;AAAA,UAC7C;AAAA,SAAA;AAAA,QAFK,CAAA,aAAA,EAAgB,KAAM,CAAA,QAAA,EAAU,CAAA;AAAA,OAIxC;AAAA;AAAA,GACH;AAEJ;;;;"}
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import Box from '@mui/material/Box';
3
3
  import Typography from '@mui/material/Typography';
4
4
  import { InfoCard } from '@backstage/core-components';
@@ -8,7 +8,7 @@ const DropdownEmptyState = ({
8
8
  subTitle,
9
9
  icon
10
10
  }) => {
11
- return /* @__PURE__ */ React.createElement(InfoCard, null, /* @__PURE__ */ React.createElement(
11
+ return /* @__PURE__ */ jsx(InfoCard, { children: /* @__PURE__ */ jsxs(
12
12
  Box,
13
13
  {
14
14
  sx: {
@@ -23,19 +23,21 @@ const DropdownEmptyState = ({
23
23
  maxWidth: 300,
24
24
  // Set max width to constrain text expansion
25
25
  mx: "auto"
26
- }
27
- },
28
- icon,
29
- /* @__PURE__ */ React.createElement(Typography, { variant: "h6", sx: { mt: 2, color: "text.primary" } }, title),
30
- /* @__PURE__ */ React.createElement(
31
- Typography,
32
- {
33
- variant: "body2",
34
- sx: { mt: 1, color: "text.secondary", maxWidth: 250 }
35
26
  },
36
- subTitle
37
- )
38
- ));
27
+ children: [
28
+ icon,
29
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { mt: 2, color: "text.primary" }, children: title }),
30
+ /* @__PURE__ */ jsx(
31
+ Typography,
32
+ {
33
+ variant: "body2",
34
+ sx: { mt: 1, color: "text.secondary", maxWidth: 250 },
35
+ children: subTitle
36
+ }
37
+ )
38
+ ]
39
+ }
40
+ ) });
39
41
  };
40
42
 
41
43
  export { DropdownEmptyState };
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownEmptyState.esm.js","sources":["../../../src/components/HeaderDropdownComponent/DropdownEmptyState.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 Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { InfoCard } from '@backstage/core-components';\n\n/**\n * @public\n * Props for dropdown empty state\n */\ninterface DropdownEmptyStateProps {\n title: string;\n subTitle: string;\n icon: React.ReactNode;\n}\n\nexport const DropdownEmptyState: React.FC<DropdownEmptyStateProps> = ({\n title,\n subTitle,\n icon,\n}) => {\n return (\n <InfoCard>\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n py: 4,\n px: 2, // Added padding to control width\n maxWidth: 300, // Set max width to constrain text expansion\n mx: 'auto',\n }}\n >\n {icon}\n <Typography variant=\"h6\" sx={{ mt: 2, color: 'text.primary' }}>\n {title}\n </Typography>\n <Typography\n variant=\"body2\"\n sx={{ mt: 1, color: 'text.secondary', maxWidth: 250 }}\n >\n {subTitle}\n </Typography>\n </Box>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;AA8BO,MAAM,qBAAwD,CAAC;AAAA,EACpE,KAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAM,KAAA;AACJ,EAAA,2CACG,QACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,OAAS,EAAA,MAAA;AAAA,QACT,aAAe,EAAA,QAAA;AAAA,QACf,UAAY,EAAA,QAAA;AAAA,QACZ,cAAgB,EAAA,QAAA;AAAA,QAChB,SAAW,EAAA,QAAA;AAAA,QACX,EAAI,EAAA,CAAA;AAAA,QACJ,EAAI,EAAA,CAAA;AAAA;AAAA,QACJ,QAAU,EAAA,GAAA;AAAA;AAAA,QACV,EAAI,EAAA;AAAA;AACN,KAAA;AAAA,IAEC,IAAA;AAAA,oBACD,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAK,EAAA,EAAA,EAAI,EAAE,EAAA,EAAI,CAAG,EAAA,KAAA,EAAO,cAAe,EAAA,EAAA,EACzD,KACH,CAAA;AAAA,oBACA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,OAAA;AAAA,QACR,IAAI,EAAE,EAAA,EAAI,GAAG,KAAO,EAAA,gBAAA,EAAkB,UAAU,GAAI;AAAA,OAAA;AAAA,MAEnD;AAAA;AACH,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"DropdownEmptyState.esm.js","sources":["../../../src/components/HeaderDropdownComponent/DropdownEmptyState.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 { ReactNode, FC } from 'react';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { InfoCard } from '@backstage/core-components';\n\n/**\n * @public\n * Props for dropdown empty state\n */\ninterface DropdownEmptyStateProps {\n title: string;\n subTitle: string;\n icon: ReactNode;\n}\n\nexport const DropdownEmptyState: FC<DropdownEmptyStateProps> = ({\n title,\n subTitle,\n icon,\n}) => {\n return (\n <InfoCard>\n <Box\n sx={{\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n textAlign: 'center',\n py: 4,\n px: 2, // Added padding to control width\n maxWidth: 300, // Set max width to constrain text expansion\n mx: 'auto',\n }}\n >\n {icon}\n <Typography variant=\"h6\" sx={{ mt: 2, color: 'text.primary' }}>\n {title}\n </Typography>\n <Typography\n variant=\"body2\"\n sx={{ mt: 1, color: 'text.secondary', maxWidth: 250 }}\n >\n {subTitle}\n </Typography>\n </Box>\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;AA8BO,MAAM,qBAAkD,CAAC;AAAA,EAC9D,KAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAM,KAAA;AACJ,EAAA,2BACG,QACC,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,OAAS,EAAA,MAAA;AAAA,QACT,aAAe,EAAA,QAAA;AAAA,QACf,UAAY,EAAA,QAAA;AAAA,QACZ,cAAgB,EAAA,QAAA;AAAA,QAChB,SAAW,EAAA,QAAA;AAAA,QACX,EAAI,EAAA,CAAA;AAAA,QACJ,EAAI,EAAA,CAAA;AAAA;AAAA,QACJ,QAAU,EAAA,GAAA;AAAA;AAAA,QACV,EAAI,EAAA;AAAA,OACN;AAAA,MAEC,QAAA,EAAA;AAAA,QAAA,IAAA;AAAA,wBACD,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAK,EAAA,EAAA,EAAI,EAAE,EAAA,EAAI,CAAG,EAAA,KAAA,EAAO,cAAe,EAAA,EACzD,QACH,EAAA,KAAA,EAAA,CAAA;AAAA,wBACA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,OAAQ,EAAA,OAAA;AAAA,YACR,IAAI,EAAE,EAAA,EAAI,GAAG,KAAO,EAAA,gBAAA,EAAkB,UAAU,GAAI,EAAA;AAAA,YAEnD,QAAA,EAAA;AAAA;AAAA;AACH;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useId } from 'react';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useId } from 'react';
2
3
  import Menu from '@mui/material/Menu';
3
4
  import Button from '@mui/material/Button';
4
5
  import Box from '@mui/material/Box';
@@ -47,34 +48,37 @@ const HeaderDropdownComponent = ({
47
48
  "aria-controls": id,
48
49
  "aria-expanded": anchorEl ? true : void 0
49
50
  };
50
- return /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(Tooltip, { title: tooltip }, isIconButton ? /* @__PURE__ */ React.createElement(IconButton, { ...commonButtonProps, color: "inherit", size }, buttonContent) : /* @__PURE__ */ React.createElement(Button, { disableRipple: true, disableTouchRipple: true, ...commonButtonProps }, buttonContent)), /* @__PURE__ */ React.createElement(
51
- Menu,
52
- {
53
- id: `${id}-menu`,
54
- anchorEl,
55
- keepMounted: true,
56
- open: Boolean(anchorEl),
57
- onClose,
58
- anchorOrigin: {
59
- vertical: "bottom",
60
- horizontal: "center"
61
- },
62
- transformOrigin: {
63
- vertical: "top",
64
- horizontal: "center"
65
- },
66
- sx: {
67
- '& ul[class*="MuiMenu-list"]': {
68
- py: 0
69
- }
70
- },
71
- MenuListProps: {
72
- "aria-labelledby": id,
73
- sx: (theme) => menuListStyle(theme)
51
+ return /* @__PURE__ */ jsxs(Box, { children: [
52
+ /* @__PURE__ */ jsx(Tooltip, { title: tooltip, children: isIconButton ? /* @__PURE__ */ jsx(IconButton, { ...commonButtonProps, color: "inherit", size, children: buttonContent }) : /* @__PURE__ */ jsx(Button, { disableRipple: true, disableTouchRipple: true, ...commonButtonProps, children: buttonContent }) }),
53
+ /* @__PURE__ */ jsx(
54
+ Menu,
55
+ {
56
+ id: `${id}-menu`,
57
+ anchorEl,
58
+ keepMounted: true,
59
+ open: Boolean(anchorEl),
60
+ onClose,
61
+ anchorOrigin: {
62
+ vertical: "bottom",
63
+ horizontal: "center"
64
+ },
65
+ transformOrigin: {
66
+ vertical: "top",
67
+ horizontal: "center"
68
+ },
69
+ sx: {
70
+ '& ul[class*="MuiMenu-list"]': {
71
+ py: 0
72
+ }
73
+ },
74
+ MenuListProps: {
75
+ "aria-labelledby": id,
76
+ sx: (theme) => menuListStyle(theme)
77
+ },
78
+ children
74
79
  }
75
- },
76
- children
77
- ));
80
+ )
81
+ ] });
78
82
  };
79
83
 
80
84
  export { HeaderDropdownComponent };
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderDropdownComponent.esm.js","sources":["../../../src/components/HeaderDropdownComponent/HeaderDropdownComponent.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, { useId } from 'react';\nimport Menu from '@mui/material/Menu';\nimport Button from '@mui/material/Button';\nimport { Theme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport IconButton, { IconButtonProps } from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport { MenuItemConfig, MenuSectionConfig } from './MenuSection';\n\ninterface HeaderDropdownProps {\n buttonContent: React.ReactNode;\n children: React.ReactNode;\n menuSections?: MenuSectionConfig[];\n menuBottomItems?: MenuItemConfig[];\n buttonProps?: React.ComponentProps<typeof Button>;\n onOpen: (event: React.MouseEvent<HTMLElement>) => void;\n onClose: () => void;\n anchorEl: HTMLElement | null;\n isIconButton?: boolean;\n tooltip?: string;\n size?: IconButtonProps['size'];\n}\n\nconst menuListStyle = (theme: Theme) => ({\n fontSize: '0.875rem',\n boxSizing: 'border-box',\n padding: 0,\n margin: 0,\n minWidth: '160px',\n borderRadius: '4px',\n textDecoration: 'none',\n listStyle: 'none',\n overflow: 'auto',\n outline: '1px solid transparent',\n background: theme.palette.background.paper,\n border: `1px solid ${theme.palette.divider}`,\n color:\n theme.palette.mode === 'dark'\n ? theme.palette.text.disabled\n : theme.palette.text.primary,\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 maxHeight: '60vh',\n zIndex: 1,\n});\n\nexport const HeaderDropdownComponent: React.FC<HeaderDropdownProps> = ({\n buttonContent,\n children,\n buttonProps,\n onOpen,\n onClose,\n anchorEl,\n isIconButton = false,\n size = 'small',\n tooltip,\n}) => {\n const id = useId();\n\n const commonButtonProps = {\n ...buttonProps,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n onOpen(event);\n // focus the menu when opened\n // TODO: investigate why MUI isn't doing this for us\n setTimeout(() => {\n document\n .getElementById(`${id}-menu`)\n ?.getElementsByTagName('a')[0]\n ?.focus();\n }, 0);\n },\n 'aria-haspopup': true,\n 'aria-controls': id,\n 'aria-expanded': anchorEl ? true : undefined,\n };\n\n return (\n <Box>\n <Tooltip title={tooltip}>\n {isIconButton ? (\n <IconButton {...commonButtonProps} color=\"inherit\" size={size}>\n {buttonContent}\n </IconButton>\n ) : (\n <Button disableRipple disableTouchRipple {...commonButtonProps}>\n {buttonContent}\n </Button>\n )}\n </Tooltip>\n <Menu\n id={`${id}-menu`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n sx={{\n '& ul[class*=\"MuiMenu-list\"]': {\n py: 0,\n },\n }}\n MenuListProps={{\n 'aria-labelledby': id,\n sx: theme => menuListStyle(theme),\n }}\n >\n {children}\n </Menu>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuCA,MAAM,aAAA,GAAgB,CAAC,KAAkB,MAAA;AAAA,EACvC,QAAU,EAAA,UAAA;AAAA,EACV,SAAW,EAAA,YAAA;AAAA,EACX,OAAS,EAAA,CAAA;AAAA,EACT,MAAQ,EAAA,CAAA;AAAA,EACR,QAAU,EAAA,OAAA;AAAA,EACV,YAAc,EAAA,KAAA;AAAA,EACd,cAAgB,EAAA,MAAA;AAAA,EAChB,SAAW,EAAA,MAAA;AAAA,EACX,QAAU,EAAA,MAAA;AAAA,EACV,OAAS,EAAA,uBAAA;AAAA,EACT,UAAA,EAAY,KAAM,CAA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A,aAAA,CAAC,OAAQ,EAAA,EAAA,KAAA,EAAO,OACb,EAAA,EAAA,YAAA,mBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAY,GAAG,iBAAA,EAAmB,KAAM,EAAA,SAAA,EAAU,QAChD,aACH,CAAA,mBAEC,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,aAAa,EAAA,IAAA,EAAC,kBAAkB,EAAA,IAAA,EAAE,GAAG,iBAAA,EAAA,EAC1C,aACH,CAEJ,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,EAAA,EAAI,GAAG,EAAE,CAAA,KAAA,CAAA;AAAA,MACT,QAAA;AAAA,MACA,WAAW,EAAA,IAAA;AAAA,MACX,IAAA,EAAM,QAAQ,QAAQ,CAAA;AAAA,MACtB,OAAA;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,QAAU,EAAA,QAAA;AAAA,QACV,UAAY,EAAA;AAAA,OACd;AAAA,MACA,eAAiB,EAAA;AAAA,QACf,QAAU,EAAA,KAAA;AAAA,QACV,UAAY,EAAA;AAAA,OACd;AAAA,MACA,EAAI,EAAA;AAAA,QACF,6BAA+B,EAAA;AAAA,UAC7B,EAAI,EAAA;AAAA;AACN,OACF;AAAA,MACA,aAAe,EAAA;AAAA,QACb,iBAAmB,EAAA,EAAA;AAAA,QACnB,EAAA,EAAI,CAAS,KAAA,KAAA,aAAA,CAAc,KAAK;AAAA;AAClC,KAAA;AAAA,IAEC;AAAA,GAEL,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"HeaderDropdownComponent.esm.js","sources":["../../../src/components/HeaderDropdownComponent/HeaderDropdownComponent.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 { useId } from 'react';\nimport type { ReactNode, ComponentProps, MouseEvent, FC } from 'react';\nimport Menu from '@mui/material/Menu';\nimport Button from '@mui/material/Button';\nimport { Theme } from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport IconButton, { IconButtonProps } from '@mui/material/IconButton';\nimport Tooltip from '@mui/material/Tooltip';\nimport { MenuItemConfig, MenuSectionConfig } from './MenuSection';\n\ninterface HeaderDropdownProps {\n buttonContent: ReactNode;\n children: ReactNode;\n menuSections?: MenuSectionConfig[];\n menuBottomItems?: MenuItemConfig[];\n buttonProps?: ComponentProps<typeof Button>;\n onOpen: (event: MouseEvent<HTMLElement>) => void;\n onClose: () => void;\n anchorEl: HTMLElement | null;\n isIconButton?: boolean;\n tooltip?: string;\n size?: IconButtonProps['size'];\n}\n\nconst menuListStyle = (theme: Theme) => ({\n fontSize: '0.875rem',\n boxSizing: 'border-box',\n padding: 0,\n margin: 0,\n minWidth: '160px',\n borderRadius: '4px',\n textDecoration: 'none',\n listStyle: 'none',\n overflow: 'auto',\n outline: '1px solid transparent',\n background: theme.palette.background.paper,\n border: `1px solid ${theme.palette.divider}`,\n color:\n theme.palette.mode === 'dark'\n ? theme.palette.text.disabled\n : theme.palette.text.primary,\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 maxHeight: '60vh',\n zIndex: 1,\n});\n\nexport const HeaderDropdownComponent: FC<HeaderDropdownProps> = ({\n buttonContent,\n children,\n buttonProps,\n onOpen,\n onClose,\n anchorEl,\n isIconButton = false,\n size = 'small',\n tooltip,\n}) => {\n const id = useId();\n\n const commonButtonProps = {\n ...buttonProps,\n onClick: (event: MouseEvent<HTMLElement>) => {\n onOpen(event);\n // focus the menu when opened\n // TODO: investigate why MUI isn't doing this for us\n setTimeout(() => {\n document\n .getElementById(`${id}-menu`)\n ?.getElementsByTagName('a')[0]\n ?.focus();\n }, 0);\n },\n 'aria-haspopup': true,\n 'aria-controls': id,\n 'aria-expanded': anchorEl ? true : undefined,\n };\n\n return (\n <Box>\n <Tooltip title={tooltip}>\n {isIconButton ? (\n <IconButton {...commonButtonProps} color=\"inherit\" size={size}>\n {buttonContent}\n </IconButton>\n ) : (\n <Button disableRipple disableTouchRipple {...commonButtonProps}>\n {buttonContent}\n </Button>\n )}\n </Tooltip>\n <Menu\n id={`${id}-menu`}\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={onClose}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'center',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'center',\n }}\n sx={{\n '& ul[class*=\"MuiMenu-list\"]': {\n py: 0,\n },\n }}\n MenuListProps={{\n 'aria-labelledby': id,\n sx: theme => menuListStyle(theme),\n }}\n >\n {children}\n </Menu>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwCA,MAAM,aAAA,GAAgB,CAAC,KAAkB,MAAA;AAAA,EACvC,QAAU,EAAA,UAAA;AAAA,EACV,SAAW,EAAA,YAAA;AAAA,EACX,OAAS,EAAA,CAAA;AAAA,EACT,MAAQ,EAAA,CAAA;AAAA,EACR,QAAU,EAAA,OAAA;AAAA,EACV,YAAc,EAAA,KAAA;AAAA,EACd,cAAgB,EAAA,MAAA;AAAA,EAChB,SAAW,EAAA,MAAA;AAAA,EACX,QAAU,EAAA,MAAA;AAAA,EACV,OAAS,EAAA,uBAAA;AAAA,EACT,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA,KAAA;AAAA,EACrC,MAAQ,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,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,EAAM,SAAU,EAAA,IAAA,EAChD,yBACH,CAEA,mBAAA,GAAA,CAAC,UAAO,aAAa,EAAA,IAAA,EAAC,oBAAkB,IAAE,EAAA,GAAG,iBAC1C,EAAA,QAAA,EAAA,aAAA,EACH,CAEJ,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACC,EAAA,EAAI,GAAG,EAAE,CAAA,KAAA,CAAA;AAAA,QACT,QAAA;AAAA,QACA,WAAW,EAAA,IAAA;AAAA,QACX,IAAA,EAAM,QAAQ,QAAQ,CAAA;AAAA,QACtB,OAAA;AAAA,QACA,YAAc,EAAA;AAAA,UACZ,QAAU,EAAA,QAAA;AAAA,UACV,UAAY,EAAA;AAAA,SACd;AAAA,QACA,eAAiB,EAAA;AAAA,UACf,QAAU,EAAA,KAAA;AAAA,UACV,UAAY,EAAA;AAAA,SACd;AAAA,QACA,EAAI,EAAA;AAAA,UACF,6BAA+B,EAAA;AAAA,YAC7B,EAAI,EAAA;AAAA;AACN,SACF;AAAA,QACA,aAAe,EAAA;AAAA,UACb,iBAAmB,EAAA,EAAA;AAAA,UACnB,EAAA,EAAI,CAAS,KAAA,KAAA,aAAA,CAAc,KAAK;AAAA,SAClC;AAAA,QAEC;AAAA;AAAA;AACH,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { Fragment } from 'react';
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { Fragment as Fragment$1 } from 'react';
2
3
  import Divider from '@mui/material/Divider';
3
4
  import Box from '@mui/material/Box';
4
5
  import MenuItem from '@mui/material/MenuItem';
@@ -14,58 +15,64 @@ const MenuSection = ({
14
15
  handleClose
15
16
  }) => {
16
17
  const hasClickableSubheader = optionalLink && optionalLinkLabel && items.length > 0;
17
- return /* @__PURE__ */ React.createElement(React.Fragment, null, sectionLabel && /* @__PURE__ */ React.createElement(
18
- MenuItem,
19
- {
20
- sx: {
21
- p: 0
22
- },
23
- disableRipple: true,
24
- disableTouchRipple: true,
25
- component: hasClickableSubheader ? Link : Fragment,
26
- to: optionalLink,
27
- onClick: handleClose
28
- },
29
- /* @__PURE__ */ React.createElement(
30
- ListSubheader,
18
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
19
+ sectionLabel && /* @__PURE__ */ jsxs(
20
+ MenuItem,
31
21
  {
32
22
  sx: {
33
- backgroundColor: "transparent",
34
- m: 0,
35
- color: "text.disabled",
36
- lineHeight: 2,
37
- mt: "0.5rem",
38
- fontWeight: 400
39
- }
40
- },
41
- sectionLabel
23
+ p: 0
24
+ },
25
+ disableRipple: true,
26
+ disableTouchRipple: true,
27
+ component: hasClickableSubheader ? Link : Fragment$1,
28
+ to: optionalLink,
29
+ onClick: handleClose,
30
+ children: [
31
+ /* @__PURE__ */ jsx(
32
+ ListSubheader,
33
+ {
34
+ sx: {
35
+ backgroundColor: "transparent",
36
+ m: 0,
37
+ color: "text.disabled",
38
+ lineHeight: 2,
39
+ mt: "0.5rem",
40
+ fontWeight: 400
41
+ },
42
+ children: sectionLabel
43
+ }
44
+ ),
45
+ optionalLinkLabel && /* @__PURE__ */ jsx(
46
+ Box,
47
+ {
48
+ sx: {
49
+ fontSize: "0.875em",
50
+ mr: 2,
51
+ flexGrow: 1,
52
+ textAlign: "right",
53
+ mt: "0.5rem"
54
+ },
55
+ children: optionalLinkLabel
56
+ }
57
+ )
58
+ ]
59
+ }
42
60
  ),
43
- optionalLinkLabel && /* @__PURE__ */ React.createElement(
44
- Box,
61
+ items.map(({ icon, label, subLabel, link, Component }, index) => /* @__PURE__ */ jsx(
62
+ MenuItem,
45
63
  {
46
- sx: {
47
- fontSize: "0.875em",
48
- mr: 2,
49
- flexGrow: 1,
50
- textAlign: "right",
51
- mt: "0.5rem"
52
- }
64
+ disableRipple: true,
65
+ disableTouchRipple: true,
66
+ onClick: handleClose,
67
+ sx: { py: 0.5 },
68
+ component: link ? Link : Fragment$1,
69
+ to: link,
70
+ children: /* @__PURE__ */ jsx(Component, { icon, to: link, title: label, subTitle: subLabel })
53
71
  },
54
- optionalLinkLabel
55
- )
56
- ), items.map(({ icon, label, subLabel, link, Component }, index) => /* @__PURE__ */ React.createElement(
57
- MenuItem,
58
- {
59
- key: `menu-item-${index.toString()}`,
60
- disableRipple: true,
61
- disableTouchRipple: true,
62
- onClick: handleClose,
63
- sx: { py: 0.5 },
64
- component: link ? Link : Fragment,
65
- to: link
66
- },
67
- /* @__PURE__ */ React.createElement(Component, { icon, to: link, title: label, subTitle: subLabel })
68
- )), !hideDivider && /* @__PURE__ */ React.createElement(Divider, { sx: { my: 0.5 } }));
72
+ `menu-item-${index.toString()}`
73
+ )),
74
+ !hideDivider && /* @__PURE__ */ jsx(Divider, { sx: { my: 0.5 } })
75
+ ] });
69
76
  };
70
77
 
71
78
  export { MenuSection };
@@ -1 +1 @@
1
- {"version":3,"file":"MenuSection.esm.js","sources":["../../../src/components/HeaderDropdownComponent/MenuSection.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, { Fragment } from 'react';\nimport Divider from '@mui/material/Divider';\nimport Box from '@mui/material/Box';\nimport MenuItem from '@mui/material/MenuItem';\nimport { Link } from '@backstage/core-components';\nimport { MenuItemLinkProps } from '../MenuItemLink/MenuItemLink';\nimport ListSubheader from '@mui/material/ListSubheader';\n\n/**\n * Menu item configuration\n *\n * @public\n */\nexport interface MenuItemConfig {\n Component: React.ComponentType<MenuItemLinkProps | {}>;\n label: string;\n icon?: string;\n subLabel?: string;\n link?: string;\n}\n\nexport interface MenuSectionConfig {\n sectionLabel?: string;\n optionalLink?: string;\n optionalLinkLabel?: string;\n items: MenuItemConfig[];\n hideDivider?: boolean;\n handleClose: () => void;\n}\n\nexport const MenuSection: React.FC<MenuSectionConfig> = ({\n sectionLabel,\n optionalLink,\n optionalLinkLabel,\n items,\n hideDivider = false,\n handleClose,\n}) => {\n const hasClickableSubheader =\n optionalLink && optionalLinkLabel && items.length > 0;\n\n return (\n <>\n {sectionLabel && (\n <MenuItem\n sx={{\n p: 0,\n }}\n disableRipple\n disableTouchRipple\n component={hasClickableSubheader ? Link : Fragment}\n to={optionalLink}\n onClick={handleClose}\n >\n <ListSubheader\n sx={{\n backgroundColor: 'transparent',\n m: 0,\n color: 'text.disabled',\n lineHeight: 2,\n mt: '0.5rem',\n fontWeight: 400,\n }}\n >\n {sectionLabel}\n </ListSubheader>\n\n {optionalLinkLabel && (\n <Box\n sx={{\n fontSize: '0.875em',\n mr: 2,\n flexGrow: 1,\n textAlign: 'right',\n mt: '0.5rem',\n }}\n >\n {optionalLinkLabel}\n </Box>\n )}\n </MenuItem>\n )}\n\n {items.map(({ icon, label, subLabel, link, Component }, index) => (\n <MenuItem\n key={`menu-item-${index.toString()}`}\n disableRipple\n disableTouchRipple\n onClick={handleClose}\n sx={{ py: 0.5 }}\n component={link ? Link : Fragment}\n to={link}\n >\n <Component icon={icon} to={link!} title={label} subTitle={subLabel} />\n </MenuItem>\n ))}\n {!hideDivider && <Divider sx={{ my: 0.5 }} />}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA8CO,MAAM,cAA2C,CAAC;AAAA,EACvD,YAAA;AAAA,EACA,YAAA;AAAA,EACA,iBAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAc,GAAA,KAAA;AAAA,EACd;AACF,CAAM,KAAA;AACJ,EAAA,MAAM,qBACJ,GAAA,YAAA,IAAgB,iBAAqB,IAAA,KAAA,CAAM,MAAS,GAAA,CAAA;AAEtD,EAAA,iEAEK,YACC,oBAAA,KAAA,CAAA,aAA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AA;AAAA,MACd,SAAA,EAAW,OAAO,IAAO,GAAA,QAAA;AAAA,MACzB,EAAI,EAAA;AAAA,KAAA;AAAA,oBAEJ,KAAA,CAAA,aAAA,CAAC,aAAU,IAAY,EAAA,EAAA,EAAI,MAAO,KAAO,EAAA,KAAA,EAAO,UAAU,QAAU,EAAA;AAAA,GAEvE,CACA,EAAA,CAAC,WAAe,oBAAA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,EAAA,EAAI,EAAE,EAAA,EAAI,GAAI,EAAA,EAAG,CAC7C,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"MenuSection.esm.js","sources":["../../../src/components/HeaderDropdownComponent/MenuSection.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 { Fragment } from 'react';\nimport type { ComponentType, FC } from 'react';\nimport Divider from '@mui/material/Divider';\nimport Box from '@mui/material/Box';\nimport MenuItem from '@mui/material/MenuItem';\nimport { Link } from '@backstage/core-components';\nimport { MenuItemLinkProps } from '../MenuItemLink/MenuItemLink';\nimport ListSubheader from '@mui/material/ListSubheader';\n\n/**\n * Menu item configuration\n *\n * @public\n */\nexport interface MenuItemConfig {\n Component: ComponentType<MenuItemLinkProps | {}>;\n label: string;\n icon?: string;\n subLabel?: string;\n link?: string;\n}\n\nexport interface MenuSectionConfig {\n sectionLabel?: string;\n optionalLink?: string;\n optionalLinkLabel?: string;\n items: MenuItemConfig[];\n hideDivider?: boolean;\n handleClose: () => void;\n}\n\nexport const MenuSection: FC<MenuSectionConfig> = ({\n sectionLabel,\n optionalLink,\n optionalLinkLabel,\n items,\n hideDivider = false,\n handleClose,\n}) => {\n const hasClickableSubheader =\n optionalLink && optionalLinkLabel && items.length > 0;\n\n return (\n <>\n {sectionLabel && (\n <MenuItem\n sx={{\n p: 0,\n }}\n disableRipple\n disableTouchRipple\n component={hasClickableSubheader ? Link : Fragment}\n to={optionalLink}\n onClick={handleClose}\n >\n <ListSubheader\n sx={{\n backgroundColor: 'transparent',\n m: 0,\n color: 'text.disabled',\n lineHeight: 2,\n mt: '0.5rem',\n fontWeight: 400,\n }}\n >\n {sectionLabel}\n </ListSubheader>\n\n {optionalLinkLabel && (\n <Box\n sx={{\n fontSize: '0.875em',\n mr: 2,\n flexGrow: 1,\n textAlign: 'right',\n mt: '0.5rem',\n }}\n >\n {optionalLinkLabel}\n </Box>\n )}\n </MenuItem>\n )}\n\n {items.map(({ icon, label, subLabel, link, Component }, index) => (\n <MenuItem\n key={`menu-item-${index.toString()}`}\n disableRipple\n disableTouchRipple\n onClick={handleClose}\n sx={{ py: 0.5 }}\n component={link ? Link : Fragment}\n to={link}\n >\n <Component icon={icon} to={link!} title={label} subTitle={subLabel} />\n </MenuItem>\n ))}\n {!hideDivider && <Divider sx={{ my: 0.5 }} />}\n </>\n );\n};\n"],"names":["Fragment"],"mappings":";;;;;;;;AA+CO,MAAM,cAAqC,CAAC;AAAA,EACjD,YAAA;AAAA,EACA,YAAA;AAAA,EACA,iBAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAc,GAAA,KAAA;AAAA,EACd;AACF,CAAM,KAAA;AACJ,EAAA,MAAM,qBACJ,GAAA,YAAA,IAAgB,iBAAqB,IAAA,KAAA,CAAM,MAAS,GAAA,CAAA;AAEtD,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IACC,YAAA,oBAAA,IAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,EAAI,EAAA;AAAA,UACF,CAAG,EAAA;AAAA,SACL;AAAA,QACA,aAA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,EAAI,MAAO,KAAO,EAAA,KAAA,EAAO,UAAU,QAAU,EAAA;AAAA,OAAA;AAAA,MAR/D,CAAA,UAAA,EAAa,KAAM,CAAA,QAAA,EAAU,CAAA;AAAA,KAUrC,CAAA;AAAA,IACA,CAAC,+BAAgB,GAAA,CAAA,OAAA,EAAA,EAAQ,IAAI,EAAE,EAAA,EAAI,KAAO,EAAA;AAAA,GAC7C,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { useState, useRef, useEffect, useMemo } from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useState, useRef, useEffect, useMemo } from 'react';
2
3
  import { useUserProfile } from '@backstage/plugin-user-settings';
3
4
  import { useApi } from '@backstage/core-plugin-api';
4
5
  import { catalogApiRef } from '@backstage/plugin-catalog-react';
@@ -79,36 +80,42 @@ const ProfileDropdown = ({ layout }) => {
79
80
  }
80
81
  return name;
81
82
  };
82
- return /* @__PURE__ */ React.createElement(
83
+ return /* @__PURE__ */ jsx(
83
84
  HeaderDropdownComponent,
84
85
  {
85
- buttonContent: /* @__PURE__ */ React.createElement(Box, { sx: { display: "flex", alignItems: "center", ...layout } }, !profileLoading && /* @__PURE__ */ React.createElement(React.Fragment, null, profile.picture ? /* @__PURE__ */ React.createElement(
86
- Avatar,
87
- {
88
- src: profile.picture,
89
- sx: { mr: 2, height: "32px", width: "32px" },
90
- alt: "Profile picture"
91
- }
92
- ) : /* @__PURE__ */ React.createElement(AccountCircleOutlinedIcon, { fontSize: "small", sx: { mr: 1 } }), /* @__PURE__ */ React.createElement(
93
- Typography,
94
- {
95
- variant: "body2",
96
- sx: {
97
- display: { xs: "none", md: "block" },
98
- fontWeight: 500,
99
- mr: "1rem"
100
- }
101
- },
102
- profileDisplayName()
103
- )), /* @__PURE__ */ React.createElement(
104
- KeyboardArrowDownOutlinedIcon,
105
- {
106
- sx: {
107
- bgcolor: bgColor,
108
- borderRadius: "25%"
86
+ buttonContent: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", ...layout }, children: [
87
+ !profileLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
88
+ profile.picture ? /* @__PURE__ */ jsx(
89
+ Avatar,
90
+ {
91
+ src: profile.picture,
92
+ sx: { mr: 2, height: "32px", width: "32px" },
93
+ alt: "Profile picture"
94
+ }
95
+ ) : /* @__PURE__ */ jsx(AccountCircleOutlinedIcon, { fontSize: "small", sx: { mr: 1 } }),
96
+ /* @__PURE__ */ jsx(
97
+ Typography,
98
+ {
99
+ variant: "body2",
100
+ sx: {
101
+ display: { xs: "none", md: "block" },
102
+ fontWeight: 500,
103
+ mr: "1rem"
104
+ },
105
+ children: profileDisplayName()
106
+ }
107
+ )
108
+ ] }),
109
+ /* @__PURE__ */ jsx(
110
+ KeyboardArrowDownOutlinedIcon,
111
+ {
112
+ sx: {
113
+ bgcolor: bgColor,
114
+ borderRadius: "25%"
115
+ }
109
116
  }
110
- }
111
- )),
117
+ )
118
+ ] }),
112
119
  buttonProps: {
113
120
  color: "inherit",
114
121
  sx: {
@@ -118,9 +125,9 @@ const ProfileDropdown = ({ layout }) => {
118
125
  },
119
126
  onOpen: handleOpen,
120
127
  onClose: handleClose,
121
- anchorEl
122
- },
123
- /* @__PURE__ */ React.createElement(MenuSection, { hideDivider: true, items: menuItems, handleClose })
128
+ anchorEl,
129
+ children: /* @__PURE__ */ jsx(MenuSection, { hideDivider: true, items: menuItems, handleClose })
130
+ }
124
131
  );
125
132
  };
126
133