@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.
- package/CHANGELOG.md +12 -0
- package/app-config.dynamic.yaml +8 -1
- package/config.d.ts +31 -0
- package/dist/components/CompanyLogo/CompanyLogo.esm.js +64 -0
- package/dist/components/CompanyLogo/CompanyLogo.esm.js.map +1 -0
- package/dist/components/CompanyLogo/DefaultLogo.esm.js +237 -0
- package/dist/components/CompanyLogo/DefaultLogo.esm.js.map +1 -0
- package/dist/components/Divider/Divider.esm.js +2 -2
- package/dist/components/Divider/Divider.esm.js.map +1 -1
- package/dist/components/GlobalHeader.esm.js +2 -2
- package/dist/components/GlobalHeader.esm.js.map +1 -1
- package/dist/components/GlobalHeaderComponent.esm.js +13 -12
- package/dist/components/GlobalHeaderComponent.esm.js.map +1 -1
- package/dist/components/HeaderButton/HeaderButton.esm.js +9 -9
- package/dist/components/HeaderButton/HeaderButton.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js +29 -28
- package/dist/components/HeaderDropdownComponent/ApplicationLauncherDropdown.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js +17 -13
- package/dist/components/HeaderDropdownComponent/CreateDropdown.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js +16 -14
- package/dist/components/HeaderDropdownComponent/DropdownEmptyState.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/HeaderDropdownComponent.esm.js +32 -28
- package/dist/components/HeaderDropdownComponent/HeaderDropdownComponent.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/MenuSection.esm.js +55 -48
- package/dist/components/HeaderDropdownComponent/MenuSection.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js +38 -31
- package/dist/components/HeaderDropdownComponent/ProfileDropdown.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js +2 -2
- package/dist/components/HeaderDropdownComponent/RegisterAComponentSection.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js +15 -11
- package/dist/components/HeaderDropdownComponent/SoftwareTemplatesSection.esm.js.map +1 -1
- package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js +55 -50
- package/dist/components/HeaderDropdownComponent/StarredDropdown.esm.js.map +1 -1
- package/dist/components/HeaderIcon/HeaderIcon.esm.js +11 -11
- package/dist/components/HeaderIcon/HeaderIcon.esm.js.map +1 -1
- package/dist/components/HeaderIconButton/HeaderIconButton.esm.js +7 -7
- package/dist/components/HeaderIconButton/HeaderIconButton.esm.js.map +1 -1
- package/dist/components/LogoutButton/LogoutButton.esm.js +5 -5
- package/dist/components/LogoutButton/LogoutButton.esm.js.map +1 -1
- package/dist/components/MenuItemLink/MenuItemLink.esm.js +6 -3
- package/dist/components/MenuItemLink/MenuItemLink.esm.js.map +1 -1
- package/dist/components/MenuItemLink/MenuItemLinkContent.esm.js +46 -39
- package/dist/components/MenuItemLink/MenuItemLinkContent.esm.js.map +1 -1
- package/dist/components/NotificationBanner.esm.js +9 -8
- package/dist/components/NotificationBanner.esm.js.map +1 -1
- package/dist/components/NotificationButton/NotificationButton.esm.js +7 -7
- package/dist/components/NotificationButton/NotificationButton.esm.js.map +1 -1
- package/dist/components/SearchComponent/SearchBar.esm.js +7 -6
- package/dist/components/SearchComponent/SearchBar.esm.js.map +1 -1
- package/dist/components/SearchComponent/SearchComponent.esm.js +7 -6
- package/dist/components/SearchComponent/SearchComponent.esm.js.map +1 -1
- package/dist/components/SearchComponent/SearchInput.esm.js +3 -3
- package/dist/components/SearchComponent/SearchInput.esm.js.map +1 -1
- package/dist/components/SearchComponent/SearchOption.esm.js +19 -13
- package/dist/components/SearchComponent/SearchOption.esm.js.map +1 -1
- package/dist/components/SearchComponent/SearchResultItem.esm.js +18 -18
- package/dist/components/SearchComponent/SearchResultItem.esm.js.map +1 -1
- package/dist/components/Spacer/Spacer.esm.js +2 -2
- package/dist/components/Spacer/Spacer.esm.js.map +1 -1
- package/dist/components/SupportButton/SupportButton.esm.js +17 -17
- package/dist/components/SupportButton/SupportButton.esm.js.map +1 -1
- package/dist/defaultMountPoints/defaultMountPoints.esm.js +11 -0
- package/dist/defaultMountPoints/defaultMountPoints.esm.js.map +1 -1
- package/dist/hooks/useDebouncedCallback.esm.js +4 -4
- package/dist/hooks/useDebouncedCallback.esm.js.map +1 -1
- package/dist/hooks/useDropdownManager.esm.js +2 -2
- package/dist/hooks/useDropdownManager.esm.js.map +1 -1
- package/dist/index.d.ts +51 -36
- package/dist/index.esm.js +1 -1
- package/dist/plugin.esm.js +11 -2
- package/dist/plugin.esm.js.map +1 -1
- package/dist/utils/stringUtils.esm.js +12 -12
- package/dist/utils/stringUtils.esm.js.map +1 -1
- package/package.json +28 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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__ */
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
|
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;AAC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,EAAW,OAAQ,EAAA,SAAA,EAAU,OAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA,EACrD,QACH,EAAA,QAAA,EAAA;AAAA;AAAA;AAAA;AAEJ,SACF,EAAA,CAAA;AAAA,QACC,cACC,oBAAA,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,EAAI,EAAA;AAAA,cACF,QAAU,EAAA,EAAA;AAAA,cACV,KAAA,EAAO,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
|
|
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] =
|
|
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 =
|
|
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__ */
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
49
50
|
Alert,
|
|
50
51
|
{
|
|
51
52
|
color: "warning",
|
|
52
|
-
icon: props.icon ? /* @__PURE__ */
|
|
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
|
-
|
|
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
|
|
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;AACxD,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,QAAkC,MAAM;AACtD,IAAA,IAAI,CAAC,KAAA,CAAM,OAAW,IAAA,KAAA,CAAM,YAAY,MAAQ,EAAA;AAC9C,MAAO,OAAA,KAAA,CAAA;AAAA,KACT,MAAA,IAAW,KAAM,CAAA,OAAA,KAAY,SAAW,EAAA;AACtC,MAAO,OAAA,MAAM,aAAa,IAAI,CAAA;AAAA,KAChC,MAAA,IAAW,KAAM,CAAA,OAAA,KAAY,cAAgB,EAAA;AAC3C,MAAA,OAAO,MAAM;AACX,QAAI,IAAA;AACF,UAAA,MAAM,eACJ,GAAA,YAAA,CAAa,OAAQ,CAAA,kCAAkC,CAAK,IAAA,IA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,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
|
|
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__ */
|
|
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__ */
|
|
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
|
-
|
|
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
|
|
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 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
|
|
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__ */
|
|
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__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
39
40
|
Autocomplete,
|
|
40
41
|
{
|
|
41
42
|
freeSolo: true,
|
|
@@ -75,7 +76,7 @@ const SearchBar = (props) => {
|
|
|
75
76
|
setHighlightedIndex(-1);
|
|
76
77
|
}
|
|
77
78
|
},
|
|
78
|
-
renderInput: (params) => /* @__PURE__ */
|
|
79
|
+
renderInput: (params) => /* @__PURE__ */ jsx(
|
|
79
80
|
SearchInput,
|
|
80
81
|
{
|
|
81
82
|
params,
|
|
@@ -83,7 +84,7 @@ const SearchBar = (props) => {
|
|
|
83
84
|
helperText: error ? "Error fetching results" : ""
|
|
84
85
|
}
|
|
85
86
|
),
|
|
86
|
-
renderOption: (renderProps, option, { index }) => /* @__PURE__ */
|
|
87
|
+
renderOption: (renderProps, option, { index }) => /* @__PURE__ */ jsx(
|
|
87
88
|
SearchOption,
|
|
88
89
|
{
|
|
89
90
|
option,
|
|
@@ -100,7 +101,7 @@ const SearchBar = (props) => {
|
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
);
|
|
103
|
-
});
|
|
104
|
+
} });
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
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
|
|
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 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,E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AC,KAAA;AAAA,YACT,UAAA,EAAY,QAAQ,wBAA2B,GAAA;AAAA;AAAA,SACjD;AAAA,QAEF,cAAc,CAAC,WAAA,EAAa,MAAQ,EAAA,EAAE,OACpC,qBAAA,GAAA;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,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
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__ */
|
|
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
|
-
|
|
21
|
-
));
|
|
19
|
+
},
|
|
20
|
+
children: /* @__PURE__ */ jsx(SearchBar, { query: { term: searchTerm }, setSearchTerm })
|
|
21
|
+
}
|
|
22
|
+
) });
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
export { SearchComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchComponent.esm.js","sources":["../../../src/components/SearchComponent/SearchComponent.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
|
|
1
|
+
{"version":3,"file":"SearchComponent.esm.js","sources":["../../../src/components/SearchComponent/SearchComponent.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 } from 'react';\nimport Box from '@mui/material/Box';\nimport { SearchBar } from './SearchBar';\nimport { SearchContextProvider } from '@backstage/plugin-search-react';\n\nexport const SearchComponent = () => {\n const [searchTerm, setSearchTerm] = useState<string>('');\n\n return (\n <SearchContextProvider>\n <Box\n sx={{\n position: 'relative',\n flexGrow: 1,\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'start',\n direction: 'ltr',\n }}\n >\n <SearchBar query={{ term: searchTerm }} setSearchTerm={setSearchTerm} />\n </Box>\n </SearchContextProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,kBAAkB,MAAM;AACnC,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAiB,EAAE,CAAA;AAEvD,EAAA,2BACG,qBACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA;AAAA,QACF,QAAU,EAAA,UAAA;AAAA,QACV,QAAU,EAAA,CAAA;AAAA,QACV,OAAS,EAAA,MAAA;AAAA,QACT,aAAe,EAAA,KAAA;AAAA,QACf,cAAgB,EAAA,OAAA;AAAA,QAChB,SAAW,EAAA;AAAA,OACb;AAAA,MAEA,8BAAC,SAAU,EAAA,EAAA,KAAA,EAAO,EAAE,IAAM,EAAA,UAAA,IAAc,aAA8B,EAAA;AAAA;AAAA,GAE1E,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import TextField from '@mui/material/TextField';
|
|
3
3
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
4
4
|
import SearchIcon from '@mui/icons-material/Search';
|
|
@@ -7,7 +7,7 @@ const SearchInput = ({
|
|
|
7
7
|
params,
|
|
8
8
|
error,
|
|
9
9
|
helperText
|
|
10
|
-
}) => /* @__PURE__ */
|
|
10
|
+
}) => /* @__PURE__ */ jsx(
|
|
11
11
|
TextField,
|
|
12
12
|
{
|
|
13
13
|
...params,
|
|
@@ -18,7 +18,7 @@ const SearchInput = ({
|
|
|
18
18
|
InputProps: {
|
|
19
19
|
...params.InputProps,
|
|
20
20
|
disableUnderline: true,
|
|
21
|
-
startAdornment: /* @__PURE__ */
|
|
21
|
+
startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(SearchIcon, { style: { color: "inherit" } }) })
|
|
22
22
|
},
|
|
23
23
|
sx: {
|
|
24
24
|
input: { color: "inherit" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.esm.js","sources":["../../../src/components/SearchComponent/SearchInput.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
|
|
1
|
+
{"version":3,"file":"SearchInput.esm.js","sources":["../../../src/components/SearchComponent/SearchInput.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 TextField from '@mui/material/TextField';\nimport InputAdornment from '@mui/material/InputAdornment';\nimport SearchIcon from '@mui/icons-material/Search';\n\ninterface SearchInputProps {\n params: any;\n error: boolean;\n helperText: string;\n}\n\nexport const SearchInput = ({\n params,\n error,\n helperText,\n}: SearchInputProps) => (\n <TextField\n {...params}\n placeholder=\"Search...\"\n variant=\"standard\"\n error={error}\n helperText={helperText}\n InputProps={{\n ...params.InputProps,\n disableUnderline: true,\n startAdornment: (\n <InputAdornment position=\"start\">\n <SearchIcon style={{ color: 'inherit' }} />\n </InputAdornment>\n ),\n }}\n sx={{\n input: { color: 'inherit' },\n button: { color: 'inherit' },\n '& fieldset': { border: 'none' },\n }}\n />\n);\n"],"names":[],"mappings":";;;;;AA0BO,MAAM,cAAc,CAAC;AAAA,EAC1B,MAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CACE,qBAAA,GAAA;AAAA,EAAC,SAAA;AAAA,EAAA;AAAA,IACE,GAAG,MAAA;AAAA,IACJ,WAAY,EAAA,WAAA;AAAA,IACZ,OAAQ,EAAA,UAAA;AAAA,IACR,KAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAY,EAAA;AAAA,MACV,GAAG,MAAO,CAAA,UAAA;AAAA,MACV,gBAAkB,EAAA,IAAA;AAAA,MAClB,cACE,kBAAA,GAAA,CAAC,cAAe,EAAA,EAAA,QAAA,EAAS,OACvB,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAO,EAAE,KAAA,EAAO,SAAU,EAAA,EAAG,CAC3C,EAAA;AAAA,KAEJ;AAAA,IACA,EAAI,EAAA;AAAA,MACF,KAAA,EAAO,EAAE,KAAA,EAAO,SAAU,EAAA;AAAA,MAC1B,MAAA,EAAQ,EAAE,KAAA,EAAO,SAAU,EAAA;AAAA,MAC3B,YAAA,EAAc,EAAE,MAAA,EAAQ,MAAO;AAAA;AACjC;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Box from '@mui/material/Box';
|
|
3
3
|
import Divider from '@mui/material/Divider';
|
|
4
4
|
import { Link } from '@backstage/core-components';
|
|
@@ -17,26 +17,32 @@ const SearchOption = ({
|
|
|
17
17
|
searchLink
|
|
18
18
|
}) => {
|
|
19
19
|
if (option === query?.term && index === options.length - 1) {
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
return /* @__PURE__ */ jsxs(Box, { id: "all-results", children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Divider, { sx: { my: 0.5 } }),
|
|
22
|
+
/* @__PURE__ */ jsx(Link, { to: searchLink, underline: "none", children: /* @__PURE__ */ jsx(
|
|
23
|
+
ListItem,
|
|
24
|
+
{
|
|
25
|
+
...renderProps,
|
|
26
|
+
sx: { my: 0 },
|
|
27
|
+
className: "allResultsOption",
|
|
28
|
+
children: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center" }, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Typography, { sx: { flexGrow: 1 }, children: "All results" }),
|
|
30
|
+
/* @__PURE__ */ jsx(ArrowForwardIcon, { fontSize: "small" })
|
|
31
|
+
] })
|
|
32
|
+
}
|
|
33
|
+
) })
|
|
34
|
+
] }, "all-results");
|
|
29
35
|
}
|
|
30
36
|
const result = results.find((r) => r.document.title === option);
|
|
31
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
32
38
|
SearchResultItem,
|
|
33
39
|
{
|
|
34
|
-
key: index,
|
|
35
40
|
option,
|
|
36
41
|
query,
|
|
37
42
|
result,
|
|
38
43
|
renderProps
|
|
39
|
-
}
|
|
44
|
+
},
|
|
45
|
+
index
|
|
40
46
|
);
|
|
41
47
|
};
|
|
42
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchOption.esm.js","sources":["../../../src/components/SearchComponent/SearchOption.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
|
|
1
|
+
{"version":3,"file":"SearchOption.esm.js","sources":["../../../src/components/SearchComponent/SearchOption.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 Box from '@mui/material/Box';\nimport Divider from '@mui/material/Divider';\nimport { Link } from '@backstage/core-components';\nimport ListItem from '@mui/material/ListItem';\nimport Typography from '@mui/material/Typography';\nimport ArrowForwardIcon from '@mui/icons-material/ArrowForward';\nimport { SearchResultItem } from './SearchResultItem';\nimport { Result, SearchDocument } from '@backstage/plugin-search-common';\nimport { SearchResultProps } from '@backstage/plugin-search-react';\n\ninterface SearchOptionProps {\n option: string;\n index: number;\n options: string[];\n query: SearchResultProps['query'];\n results: Result<SearchDocument>[];\n renderProps: any;\n searchLink: string;\n}\n\nexport const SearchOption = ({\n option,\n index,\n options,\n query,\n results,\n renderProps,\n searchLink,\n}: SearchOptionProps) => {\n if (option === query?.term && index === options.length - 1) {\n return (\n <Box key=\"all-results\" id=\"all-results\">\n <Divider sx={{ my: 0.5 }} />\n <Link to={searchLink} underline=\"none\">\n <ListItem\n {...renderProps}\n sx={{ my: 0 }}\n className=\"allResultsOption\"\n >\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <Typography sx={{ flexGrow: 1 }}>All results</Typography>\n <ArrowForwardIcon fontSize=\"small\" />\n </Box>\n </ListItem>\n </Link>\n </Box>\n );\n }\n\n const result = results.find(r => r.document.title === option);\n return (\n <SearchResultItem\n key={index}\n option={option}\n query={query}\n result={result}\n renderProps={renderProps}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAoCO,MAAM,eAAe,CAAC;AAAA,EAC3B,MAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAyB,KAAA;AACvB,EAAA,IAAI,WAAW,KAAO,EAAA,IAAA,IAAQ,KAAU,KAAA,OAAA,CAAQ,SAAS,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
4
|
import Box from '@mui/material/Box';
|
|
@@ -14,29 +14,29 @@ const SearchResultItem = ({
|
|
|
14
14
|
}) => {
|
|
15
15
|
const isNoResultsFound = option === "No results found";
|
|
16
16
|
const analytics = useAnalytics();
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
18
|
Box,
|
|
19
19
|
{
|
|
20
20
|
component: isNoResultsFound ? "div" : Link,
|
|
21
21
|
to: result?.document.location,
|
|
22
22
|
underline: "none",
|
|
23
|
-
sx: { width: "100%", ...isNoResultsFound ? {} : { cursor: "pointer" } }
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
sx: { width: "100%", ...isNoResultsFound ? {} : { cursor: "pointer" } },
|
|
24
|
+
children: /* @__PURE__ */ jsx(
|
|
25
|
+
ListItem,
|
|
26
|
+
{
|
|
27
|
+
...renderProps,
|
|
28
|
+
sx: { py: 1 },
|
|
29
|
+
onClick: (e) => {
|
|
30
|
+
analytics.captureEvent("discover", result?.document.title ?? "", {
|
|
31
|
+
attributes: { to: result?.document.location ?? "#" },
|
|
32
|
+
value: result?.rank
|
|
33
|
+
});
|
|
34
|
+
renderProps?.onClick?.(e);
|
|
35
|
+
},
|
|
36
|
+
children: /* @__PURE__ */ jsx(Typography, { sx: { color: "text.primary", flexGrow: 1 }, children: isNoResultsFound ? option : highlightMatch(option, query?.term ?? "") })
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
)
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResultItem.esm.js","sources":["../../../src/components/SearchComponent/SearchResultItem.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
|
|
1
|
+
{"version":3,"file":"SearchResultItem.esm.js","sources":["../../../src/components/SearchComponent/SearchResultItem.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 { Link } from '@backstage/core-components';\nimport ListItem from '@mui/material/ListItem';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport { highlightMatch } from '../../utils/stringUtils';\nimport { SearchResultProps } from '@backstage/plugin-search-react';\nimport { Result, SearchDocument } from '@backstage/plugin-search-common';\nimport { useAnalytics } from '@backstage/core-plugin-api';\n\ninterface SearchResultItemProps {\n option: string;\n query: SearchResultProps['query'];\n result: Result<SearchDocument> | undefined;\n renderProps: any;\n}\n\nexport const SearchResultItem = ({\n option,\n query,\n result,\n renderProps,\n}: SearchResultItemProps) => {\n const isNoResultsFound = option === 'No results found';\n const analytics = useAnalytics();\n\n return (\n <Box\n component={isNoResultsFound ? 'div' : Link}\n to={result?.document.location}\n underline=\"none\"\n sx={{ width: '100%', ...(isNoResultsFound ? {} : { cursor: 'pointer' }) }}\n >\n <ListItem\n {...renderProps}\n sx={{ py: 1 }}\n onClick={e => {\n analytics.captureEvent('discover', result?.document.title ?? '', {\n attributes: { to: result?.document.location ?? '#' },\n value: result?.rank,\n });\n renderProps?.onClick?.(e);\n }}\n >\n <Typography sx={{ color: 'text.primary', flexGrow: 1 }}>\n {isNoResultsFound\n ? option\n : highlightMatch(option, query?.term ?? '')}\n </Typography>\n </ListItem>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAgCO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,MAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EAAA,MAAM,mBAAmB,MAAW,KAAA,kBAAA;AACpC,EAAA,MAAM,YAAY,YAAa,EAAA;AAE/B,EACE,uBAAA,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,mBAAmB,KAAQ,GAAA,IAAA;AAAA,MACtC,EAAA,EAAI,QAAQ,QAAS,CAAA,QAAA;AAAA,MACrB,SAAU,EAAA,MAAA;AAAA,MACV,EAAA,EAAI,EAAE,KAAA,EAAO,MAAQ,EAAA,GAAI,gBAAmB,GAAA,EAAK,GAAA,EAAE,MAAQ,EAAA,SAAA,EAAa,EAAA;AAAA,MAExE,QAAA,kBAAA,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACE,GAAG,WAAA;AAAA,UACJ,EAAA,EAAI,EAAE,EAAA,EAAI,CAAE,EAAA;AAAA,UACZ,SAAS,CAAK,CAAA,KAAA;AACZ,YAAA,SAAA,CAAU,YAAa,CAAA,UAAA,EAAY,MAAQ,EAAA,QAAA,CAAS,SAAS,EAAI,EAAA;AAAA,cAC/D,YAAY,EAAE,EAAA,EAAI,MAAQ,EAAA,QAAA,CAAS,YAAY,GAAI,EAAA;AAAA,cACnD,OAAO,MAAQ,EAAA;AAAA,aAChB,CAAA;AACD,YAAA,WAAA,EAAa,UAAU,CAAC,CAAA;AAAA,WAC1B;AAAA,UAEA,8BAAC,UAAW,EAAA,EAAA,EAAA,EA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