@red-hat-developer-hub/backstage-plugin-intelligent-assistant 5.0.0 → 5.0.2

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 (102) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/alpha.d.ts +1 -2
  3. package/dist/components/Attachment.esm.js +14 -14
  4. package/dist/components/Attachment.esm.js.map +1 -1
  5. package/dist/components/CollapsedHistoryStrip.esm.js +46 -51
  6. package/dist/components/CollapsedHistoryStrip.esm.js.map +1 -1
  7. package/dist/components/DeleteModal.esm.js +1 -0
  8. package/dist/components/DeleteModal.esm.js.map +1 -1
  9. package/dist/components/FilePreview.esm.js +3 -2
  10. package/dist/components/FilePreview.esm.js.map +1 -1
  11. package/dist/components/LightSpeedChat.esm.js +580 -745
  12. package/dist/components/LightSpeedChat.esm.js.map +1 -1
  13. package/dist/components/LightspeedChatBox.esm.js +44 -72
  14. package/dist/components/LightspeedChatBox.esm.js.map +1 -1
  15. package/dist/components/LightspeedChatBoxHeader.esm.js +38 -34
  16. package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
  17. package/dist/components/LightspeedChatContainer.esm.js +6 -8
  18. package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
  19. package/dist/components/LightspeedChatModelsState.esm.js +67 -73
  20. package/dist/components/LightspeedChatModelsState.esm.js.map +1 -1
  21. package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
  22. package/dist/components/LightspeedDrawerProvider.esm.js +13 -16
  23. package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
  24. package/dist/components/LightspeedFABContent.esm.js +40 -9
  25. package/dist/components/LightspeedFABContent.esm.js.map +1 -1
  26. package/dist/components/LightspeedPage.esm.js +1 -10
  27. package/dist/components/LightspeedPage.esm.js.map +1 -1
  28. package/dist/components/McpConfigureServerModal.esm.js +79 -86
  29. package/dist/components/McpConfigureServerModal.esm.js.map +1 -1
  30. package/dist/components/McpServersSettings.esm.js +246 -212
  31. package/dist/components/McpServersSettings.esm.js.map +1 -1
  32. package/dist/components/MessageBarModelSelector.esm.js +29 -33
  33. package/dist/components/MessageBarModelSelector.esm.js.map +1 -1
  34. package/dist/components/PermissionRequiredState.esm.js +63 -63
  35. package/dist/components/PermissionRequiredState.esm.js.map +1 -1
  36. package/dist/components/RagSourceLabel.esm.js +22 -0
  37. package/dist/components/RagSourceLabel.esm.js.map +1 -0
  38. package/dist/components/RenameConversationModal.esm.js +38 -31
  39. package/dist/components/RenameConversationModal.esm.js.map +1 -1
  40. package/dist/components/Router.esm.js +4 -13
  41. package/dist/components/Router.esm.js.map +1 -1
  42. package/dist/components/SourcesChipModal.esm.js +94 -89
  43. package/dist/components/SourcesChipModal.esm.js.map +1 -1
  44. package/dist/components/ToastAlertGroup.esm.js +24 -40
  45. package/dist/components/ToastAlertGroup.esm.js.map +1 -1
  46. package/dist/components/ToolCallContent.esm.js +8 -11
  47. package/dist/components/ToolCallContent.esm.js.map +1 -1
  48. package/dist/components/notebooks/AddDocumentModal.esm.js +232 -252
  49. package/dist/components/notebooks/AddDocumentModal.esm.js.map +1 -1
  50. package/dist/components/notebooks/DeleteDocumentModal.esm.js +35 -77
  51. package/dist/components/notebooks/DeleteDocumentModal.esm.js.map +1 -1
  52. package/dist/components/notebooks/DeleteNotebookModal.esm.js +46 -81
  53. package/dist/components/notebooks/DeleteNotebookModal.esm.js.map +1 -1
  54. package/dist/components/notebooks/DocumentSidebar.esm.js +172 -196
  55. package/dist/components/notebooks/DocumentSidebar.esm.js.map +1 -1
  56. package/dist/components/notebooks/FileListItem.esm.js +69 -57
  57. package/dist/components/notebooks/FileListItem.esm.js.map +1 -1
  58. package/dist/components/notebooks/FileTypeIcon.esm.js +17 -27
  59. package/dist/components/notebooks/FileTypeIcon.esm.js.map +1 -1
  60. package/dist/components/notebooks/NotebookCard.esm.js +86 -25
  61. package/dist/components/notebooks/NotebookCard.esm.js.map +1 -1
  62. package/dist/components/notebooks/NotebookView.esm.js +367 -380
  63. package/dist/components/notebooks/NotebookView.esm.js.map +1 -1
  64. package/dist/components/notebooks/NotebooksTab.esm.js +93 -30
  65. package/dist/components/notebooks/NotebooksTab.esm.js.map +1 -1
  66. package/dist/components/notebooks/OverwriteConfirmModal.esm.js +142 -184
  67. package/dist/components/notebooks/OverwriteConfirmModal.esm.js.map +1 -1
  68. package/dist/components/notebooks/UploadResourceScreen.esm.js +58 -50
  69. package/dist/components/notebooks/UploadResourceScreen.esm.js.map +1 -1
  70. package/dist/components/notebooks/notebookDialogStyles.esm.js +33 -37
  71. package/dist/components/notebooks/notebookDialogStyles.esm.js.map +1 -1
  72. package/dist/const.esm.js +15 -2
  73. package/dist/const.esm.js.map +1 -1
  74. package/dist/hooks/useAutoScroll.esm.js +11 -11
  75. package/dist/hooks/useAutoScroll.esm.js.map +1 -1
  76. package/dist/hooks/useBufferedMessages.esm.js +5 -5
  77. package/dist/hooks/useBufferedMessages.esm.js.map +1 -1
  78. package/dist/hooks/useFeedbackActions.esm.js.map +1 -1
  79. package/dist/hooks/useIsMobile.esm.js +3 -3
  80. package/dist/hooks/useIsMobile.esm.js.map +1 -1
  81. package/dist/translations/de.esm.js +1 -2
  82. package/dist/translations/de.esm.js.map +1 -1
  83. package/dist/translations/es.esm.js +1 -2
  84. package/dist/translations/es.esm.js.map +1 -1
  85. package/dist/translations/fr.esm.js +1 -2
  86. package/dist/translations/fr.esm.js.map +1 -1
  87. package/dist/translations/it.esm.js +1 -2
  88. package/dist/translations/it.esm.js.map +1 -1
  89. package/dist/translations/ja.esm.js +1 -2
  90. package/dist/translations/ja.esm.js.map +1 -1
  91. package/dist/translations/ref.esm.js +1 -2
  92. package/dist/translations/ref.esm.js.map +1 -1
  93. package/dist/types.esm.js.map +1 -1
  94. package/dist/utils/fab-anchor-utils.esm.js +41 -0
  95. package/dist/utils/fab-anchor-utils.esm.js.map +1 -0
  96. package/dist/utils/lightspeed-chatbox-utils.esm.js +13 -6
  97. package/dist/utils/lightspeed-chatbox-utils.esm.js.map +1 -1
  98. package/dist/utils/scoped-dialog-utils.esm.js +6 -3
  99. package/dist/utils/scoped-dialog-utils.esm.js.map +1 -1
  100. package/package.json +5 -9
  101. package/dist/utils/generateClassName.esm.js +0 -12
  102. package/dist/utils/generateClassName.esm.js.map +0 -1
@@ -1,6 +1,5 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useState, useEffect } from 'react';
3
- import { TextField } from '@material-ui/core';
4
3
  import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined';
5
4
  import CloseIcon from '@mui/icons-material/Close';
6
5
  import Alert from '@mui/material/Alert';
@@ -11,6 +10,7 @@ import DialogActions from '@mui/material/DialogActions';
11
10
  import DialogContent from '@mui/material/DialogContent';
12
11
  import DialogTitle from '@mui/material/DialogTitle';
13
12
  import IconButton from '@mui/material/IconButton';
13
+ import TextField from '@mui/material/TextField';
14
14
  import Typography from '@mui/material/Typography';
15
15
  import { useConversations } from '../hooks/useConversations.esm.js';
16
16
  import { useRenameConversation } from '../hooks/useRenameConversation.esm.js';
@@ -68,35 +68,42 @@ const RenameConversationModal = ({
68
68
  "aria-describedby": "rename-modal-confirmation",
69
69
  fullWidth: true,
70
70
  children: [
71
- /* @__PURE__ */ jsx(DialogTitle, { sx: { p: "16px 20px", fontStyle: "inherit" }, children: /* @__PURE__ */ jsxs(
72
- Box,
71
+ /* @__PURE__ */ jsx(
72
+ DialogTitle,
73
73
  {
74
- sx: {
75
- display: "flex",
76
- alignItems: "center",
77
- gap: 1
78
- },
79
- children: [
80
- /* @__PURE__ */ jsx(Typography, { component: "span", sx: { fontWeight: "bold" }, children: t("conversation.rename.confirm.title") }),
81
- /* @__PURE__ */ jsx(
82
- IconButton,
83
- {
84
- "aria-label": "close",
85
- onClick: onClose,
86
- title: t("common.close"),
87
- size: "large",
88
- sx: {
89
- position: "absolute",
90
- right: 1,
91
- top: 1,
92
- color: "text.primary"
93
- },
94
- children: /* @__PURE__ */ jsx(CloseIcon, {})
95
- }
96
- )
97
- ]
74
+ id: "rename-modal",
75
+ sx: { p: "16px 20px", fontStyle: "inherit" },
76
+ children: /* @__PURE__ */ jsxs(
77
+ Box,
78
+ {
79
+ sx: {
80
+ display: "flex",
81
+ alignItems: "center",
82
+ gap: 1
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ jsx(Typography, { component: "span", sx: { fontWeight: "bold" }, children: t("conversation.rename.confirm.title") }),
86
+ /* @__PURE__ */ jsx(
87
+ IconButton,
88
+ {
89
+ "aria-label": "close",
90
+ onClick: onClose,
91
+ title: t("common.close"),
92
+ size: "large",
93
+ sx: {
94
+ position: "absolute",
95
+ right: 1,
96
+ top: 1,
97
+ color: "text.primary"
98
+ },
99
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
100
+ }
101
+ )
102
+ ]
103
+ }
104
+ )
98
105
  }
99
- ) }),
106
+ ),
100
107
  /* @__PURE__ */ jsx(DialogContent, { id: "rename-modal-body-input", children: /* @__PURE__ */ jsx(
101
108
  TextField,
102
109
  {
@@ -105,7 +112,7 @@ const RenameConversationModal = ({
105
112
  onChange: handleChatNameChange,
106
113
  fullWidth: true,
107
114
  value: chatName,
108
- style: { marginTop: "10px" },
115
+ sx: { mt: "10px" },
109
116
  variant: "outlined",
110
117
  InputProps: {
111
118
  autoFocus: true,
@@ -121,8 +128,8 @@ const RenameConversationModal = ({
121
128
  }
122
129
  }
123
130
  ) }),
124
- isError && /* @__PURE__ */ jsx(Box, { maxWidth: "650px", marginLeft: "20px", marginRight: "20px", children: /* @__PURE__ */ jsx(Alert, { severity: "error", children: String(error) }) }),
125
- /* @__PURE__ */ jsxs(DialogActions, { style: { justifyContent: "left", padding: "20px" }, children: [
131
+ isError && /* @__PURE__ */ jsx(Box, { sx: { maxWidth: "650px", mx: "20px" }, children: /* @__PURE__ */ jsx(Alert, { severity: "error", children: String(error) }) }),
132
+ /* @__PURE__ */ jsxs(DialogActions, { sx: { justifyContent: "left", p: "20px" }, children: [
126
133
  /* @__PURE__ */ jsx(
127
134
  Button,
128
135
  {
@@ -1 +1 @@
1
- {"version":3,"file":"RenameConversationModal.esm.js","sources":["../../src/components/RenameConversationModal.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, useState } from 'react';\n\nimport { TextField } from '@material-ui/core';\nimport CancelOutlinedIcon from '@mui/icons-material/CancelOutlined';\nimport CloseIcon from '@mui/icons-material/Close';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport Typography from '@mui/material/Typography';\n\nimport { useConversations } from '../hooks/useConversations';\nimport { useRenameConversation } from '../hooks/useRenameConversation';\nimport { useTranslation } from '../hooks/useTranslation';\n\nexport const RenameConversationModal = ({\n isOpen,\n onClose,\n conversationId,\n}: {\n isOpen: boolean;\n onClose: () => void;\n conversationId: string;\n}) => {\n const { t } = useTranslation();\n const {\n mutateAsync: renameConversation,\n isError,\n error,\n } = useRenameConversation();\n const { data: conversations } = useConversations();\n const [chatName, setChatName] = useState<string>('');\n const [originalChatName, setOriginalChatName] = useState<string>('');\n\n useEffect(() => {\n if (isOpen && conversations) {\n const conversation = conversations.find(\n c => c.conversation_id === conversationId,\n );\n if (conversation) {\n setChatName(conversation.topic_summary ?? '');\n setOriginalChatName(conversation.topic_summary ?? '');\n } else {\n setChatName('');\n setOriginalChatName('');\n }\n }\n }, [isOpen, conversationId, conversations]);\n\n const handleChatNameChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setChatName(event.target.value);\n };\n\n const handleRename = async () => {\n try {\n await renameConversation({\n conversation_id: conversationId,\n newName: chatName,\n invalidateCache: false,\n });\n onClose();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(e);\n }\n };\n\n return (\n <Dialog\n open={isOpen}\n onClose={onClose}\n aria-labelledby=\"rename-modal\"\n aria-describedby=\"rename-modal-confirmation\"\n fullWidth\n >\n <DialogTitle sx={{ p: '16px 20px', fontStyle: 'inherit' }}>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: 1,\n }}\n >\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>\n {t('conversation.rename.confirm.title')}\n </Typography>\n\n <IconButton\n aria-label=\"close\"\n onClick={onClose}\n title={t('common.close')}\n size=\"large\"\n sx={{\n position: 'absolute',\n right: 1,\n top: 1,\n color: 'text.primary',\n }}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent id=\"rename-modal-body-input\">\n <TextField\n id=\"outlined-chat-name-input\"\n label={t('conversation.rename.placeholder')}\n onChange={handleChatNameChange}\n fullWidth\n value={chatName}\n style={{ marginTop: '10px' }}\n variant=\"outlined\"\n InputProps={{\n autoFocus: true,\n endAdornment: (\n <IconButton\n aria-label=\"clear-input\"\n onClick={() => setChatName('')}\n edge=\"end\"\n >\n <CancelOutlinedIcon />\n </IconButton>\n ),\n }}\n />\n </DialogContent>\n {isError && (\n <Box maxWidth=\"650px\" marginLeft=\"20px\" marginRight=\"20px\">\n <Alert severity=\"error\">{String(error)}</Alert>\n </Box>\n )}\n <DialogActions style={{ justifyContent: 'left', padding: '20px' }}>\n <Button\n variant=\"contained\"\n sx={{\n textTransform: 'none',\n }}\n disabled={\n chatName.trim() === '' ||\n chatName.trim() === originalChatName.trim()\n }\n onClick={handleRename}\n >\n {t('conversation.rename.confirm.action')}\n </Button>\n <Button\n key=\"cancel\"\n variant=\"outlined\"\n sx={{\n textTransform: 'none',\n }}\n onClick={onClose}\n >\n {t('common.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmCO,MAAM,0BAA0B,CAAC;AAAA,EACtC,MAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM;AAAA,IACJ,WAAA,EAAa,kBAAA;AAAA,IACb,OAAA;AAAA,IACA;AAAA,MACE,qBAAA,EAAsB;AAC1B,EAAA,MAAM,EAAE,IAAA,EAAM,aAAA,EAAc,GAAI,gBAAA,EAAiB;AACjD,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAiB,EAAE,CAAA;AACnD,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAiB,EAAE,CAAA;AAEnE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,UAAU,aAAA,EAAe;AAC3B,MAAA,MAAM,eAAe,aAAA,CAAc,IAAA;AAAA,QACjC,CAAA,CAAA,KAAK,EAAE,eAAA,KAAoB;AAAA,OAC7B;AACA,MAAA,IAAI,YAAA,EAAc;AAChB,QAAA,WAAA,CAAY,YAAA,CAAa,iBAAiB,EAAE,CAAA;AAC5C,QAAA,mBAAA,CAAoB,YAAA,CAAa,iBAAiB,EAAE,CAAA;AAAA,MACtD,CAAA,MAAO;AACL,QAAA,WAAA,CAAY,EAAE,CAAA;AACd,QAAA,mBAAA,CAAoB,EAAE,CAAA;AAAA,MACxB;AAAA,IACF;AAAA,EACF,CAAA,EAAG,CAAC,MAAA,EAAQ,cAAA,EAAgB,aAAa,CAAC,CAAA;AAE1C,EAAA,MAAM,oBAAA,GAAuB,CAAC,KAAA,KAA+C;AAC3E,IAAA,WAAA,CAAY,KAAA,CAAM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,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,WAAA;AAAA,cACR,EAAA,EAAI;AAAA,gBACF,aAAA,EAAe;AAAA,eACjB;AAAA,cACA,QAAA,EACE,SAAS,IAAA,EAAK,KAAM,MACpB,QAAA,CAAS,IAAA,EAAK,KAAM,gBAAA,CAAiB,IAAA,EAAK;AAAA,cAE5C,OAAA,EAAS,YAAA;AAAA,cAER,YAAE,oCAAoC;AAAA;AAAA,WACzC;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cAEC,OAAA,EAAQ,UAAA;AAAA,cACR,EAAA,EAAI;AAAA,gBACF,aAAA,EAAe;AAAA,eACjB;AAAA,cACA,OAAA,EAAS,OAAA;AAAA,cAER,YAAE,eAAe;AAAA,aAAA;AAAA,YAPd;AAAA;AAQN,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"RenameConversationModal.esm.js","sources":["../../src/components/RenameConversationModal.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, useState } from 'react';\n\nimport CancelOutlinedIcon from '@mui/icons-material/CancelOutlined';\nimport CloseIcon from '@mui/icons-material/Close';\nimport Alert from '@mui/material/Alert';\nimport Box from '@mui/material/Box';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport IconButton from '@mui/material/IconButton';\nimport TextField from '@mui/material/TextField';\nimport Typography from '@mui/material/Typography';\n\nimport { useConversations } from '../hooks/useConversations';\nimport { useRenameConversation } from '../hooks/useRenameConversation';\nimport { useTranslation } from '../hooks/useTranslation';\n\nexport const RenameConversationModal = ({\n isOpen,\n onClose,\n conversationId,\n}: {\n isOpen: boolean;\n onClose: () => void;\n conversationId: string;\n}) => {\n const { t } = useTranslation();\n const {\n mutateAsync: renameConversation,\n isError,\n error,\n } = useRenameConversation();\n const { data: conversations } = useConversations();\n const [chatName, setChatName] = useState<string>('');\n const [originalChatName, setOriginalChatName] = useState<string>('');\n\n useEffect(() => {\n if (isOpen && conversations) {\n const conversation = conversations.find(\n c => c.conversation_id === conversationId,\n );\n if (conversation) {\n setChatName(conversation.topic_summary ?? '');\n setOriginalChatName(conversation.topic_summary ?? '');\n } else {\n setChatName('');\n setOriginalChatName('');\n }\n }\n }, [isOpen, conversationId, conversations]);\n\n const handleChatNameChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n setChatName(event.target.value);\n };\n\n const handleRename = async () => {\n try {\n await renameConversation({\n conversation_id: conversationId,\n newName: chatName,\n invalidateCache: false,\n });\n onClose();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn(e);\n }\n };\n\n return (\n <Dialog\n open={isOpen}\n onClose={onClose}\n aria-labelledby=\"rename-modal\"\n aria-describedby=\"rename-modal-confirmation\"\n fullWidth\n >\n <DialogTitle\n id=\"rename-modal\"\n sx={{ p: '16px 20px', fontStyle: 'inherit' }}\n >\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: 1,\n }}\n >\n <Typography component=\"span\" sx={{ fontWeight: 'bold' }}>\n {t('conversation.rename.confirm.title')}\n </Typography>\n\n <IconButton\n aria-label=\"close\"\n onClick={onClose}\n title={t('common.close')}\n size=\"large\"\n sx={{\n position: 'absolute',\n right: 1,\n top: 1,\n color: 'text.primary',\n }}\n >\n <CloseIcon />\n </IconButton>\n </Box>\n </DialogTitle>\n <DialogContent id=\"rename-modal-body-input\">\n <TextField\n id=\"outlined-chat-name-input\"\n label={t('conversation.rename.placeholder')}\n onChange={handleChatNameChange}\n fullWidth\n value={chatName}\n sx={{ mt: '10px' }}\n variant=\"outlined\"\n InputProps={{\n autoFocus: true,\n endAdornment: (\n <IconButton\n aria-label=\"clear-input\"\n onClick={() => setChatName('')}\n edge=\"end\"\n >\n <CancelOutlinedIcon />\n </IconButton>\n ),\n }}\n />\n </DialogContent>\n {isError && (\n <Box sx={{ maxWidth: '650px', mx: '20px' }}>\n <Alert severity=\"error\">{String(error)}</Alert>\n </Box>\n )}\n <DialogActions sx={{ justifyContent: 'left', p: '20px' }}>\n <Button\n variant=\"contained\"\n sx={{\n textTransform: 'none',\n }}\n disabled={\n chatName.trim() === '' ||\n chatName.trim() === originalChatName.trim()\n }\n onClick={handleRename}\n >\n {t('conversation.rename.confirm.action')}\n </Button>\n <Button\n key=\"cancel\"\n variant=\"outlined\"\n sx={{\n textTransform: 'none',\n }}\n onClick={onClose}\n >\n {t('common.cancel')}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAmCO,MAAM,0BAA0B,CAAC;AAAA,EACtC,MAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM;AAAA,IACJ,WAAA,EAAa,kBAAA;AAAA,IACb,OAAA;AAAA,IACA;AAAA,MACE,qBAAA,EAAsB;AAC1B,EAAA,MAAM,EAAE,IAAA,EAAM,aAAA,EAAc,GAAI,gBAAA,EAAiB;AACjD,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAiB,EAAE,CAAA;AACnD,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAiB,EAAE,CAAA;AAEnE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,UAAU,aAAA,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1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import { Routes, Route } from 'react-router-dom';
3
3
  import { useApi, configApiRef } from '@backstage/core-plugin-api';
4
- import { StylesProvider as StylesProvider$1 } from '@material-ui/core/styles';
5
- import { StylesProvider } from '@mui/styles';
6
- import { generateClassName, generateClassNameV4 } from '../utils/generateClassName.esm.js';
7
4
  import { LightspeedPage } from './LightspeedPage.esm.js';
8
5
 
9
6
  const Router = () => {
10
7
  const configApi = useApi(configApiRef);
11
8
  const notebooksEnabled = configApi.getOptionalBoolean("intelligent-assistant.notebooks.enabled") ?? false;
12
- return /* @__PURE__ */ jsx(StylesProvider, { generateClassName, children: /* @__PURE__ */ jsx(StylesProvider$1, { generateClassName: generateClassNameV4, children: /* @__PURE__ */ jsxs(Routes, { children: [
9
+ return /* @__PURE__ */ jsxs(Routes, { children: [
13
10
  /* @__PURE__ */ jsx(Route, { path: "/", element: /* @__PURE__ */ jsx(LightspeedPage, {}) }),
14
11
  /* @__PURE__ */ jsx(
15
12
  Route,
@@ -20,15 +17,9 @@ const Router = () => {
20
17
  ),
21
18
  notebooksEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
22
19
  /* @__PURE__ */ jsx(Route, { path: "/notebooks", element: /* @__PURE__ */ jsx(LightspeedPage, {}) }),
23
- /* @__PURE__ */ jsx(
24
- Route,
25
- {
26
- path: "/notebooks/:notebookId",
27
- element: /* @__PURE__ */ jsx(LightspeedPage, {})
28
- }
29
- )
20
+ /* @__PURE__ */ jsx(Route, { path: "/notebooks/:notebookId", element: /* @__PURE__ */ jsx(LightspeedPage, {}) })
30
21
  ] })
31
- ] }) }) });
22
+ ] });
32
23
  };
33
24
 
34
25
  export { Router };
@@ -1 +1 @@
1
- {"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.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 { Route, Routes } from 'react-router-dom';\n\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport { StylesProvider as StylesProviderV4 } from '@material-ui/core/styles';\nimport { StylesProvider } from '@mui/styles';\n\nimport {\n generateClassName,\n generateClassNameV4,\n} from '../utils/generateClassName';\nimport { LightspeedPage } from './LightspeedPage';\n\n/**\n * @public\n */\nexport const Router = () => {\n const configApi = useApi(configApiRef);\n const notebooksEnabled =\n configApi.getOptionalBoolean('intelligent-assistant.notebooks.enabled') ??\n false;\n\n return (\n <StylesProvider generateClassName={generateClassName}>\n <StylesProviderV4 generateClassName={generateClassNameV4}>\n <Routes>\n <Route path=\"/\" element={<LightspeedPage />} />\n <Route\n path=\"/conversation/:conversationId\"\n element={<LightspeedPage />}\n />\n {notebooksEnabled && (\n <>\n <Route path=\"/notebooks\" element={<LightspeedPage />} />\n <Route\n path=\"/notebooks/:notebookId\"\n element={<LightspeedPage />}\n />\n </>\n )}\n </Routes>\n </StylesProviderV4>\n </StylesProvider>\n );\n};\n"],"names":["StylesProviderV4"],"mappings":";;;;;;;;AAgCO,MAAM,SAAS,MAAM;AAC1B,EAAA,MAAM,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,gBAAA,GACJ,SAAA,CAAU,kBAAA,CAAmB,yCAAyC,CAAA,IACtE,KAAA;AAEF,EAAA,uBACE,GAAA,CAAC,kBAAe,iBAAA,EACd,QAAA,kBAAA,GAAA,CAACA,oBAAiB,iBAAA,EAAmB,mBAAA,EACnC,+BAAC,MAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAM,IAAA,EAAK,GAAA,EAAI,OAAA,kBAAS,GAAA,CAAC,kBAAe,CAAA,EAAI,CAAA;AAAA,oBAC7C,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,+BAAA;AAAA,QACL,OAAA,sBAAU,cAAA,EAAA,EAAe;AAAA;AAAA,KAC3B;AAAA,IACC,oCACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,SAAM,IAAA,EAAK,YAAA,EAAa,OAAA,kBAAS,GAAA,CAAC,kBAAe,CAAA,EAAI,CAAA;AAAA,sBACtD,GAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,wBAAA;AAAA,UACL,OAAA,sBAAU,cAAA,EAAA,EAAe;AAAA;AAAA;AAC3B,KAAA,EACF;AAAA,GAAA,EAEJ,GACF,CAAA,EACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.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 { Route, Routes } from 'react-router-dom';\n\nimport { configApiRef, useApi } from '@backstage/core-plugin-api';\n\nimport { LightspeedPage } from './LightspeedPage';\n\n/**\n * @public\n */\nexport const Router = () => {\n const configApi = useApi(configApiRef);\n const notebooksEnabled =\n configApi.getOptionalBoolean('intelligent-assistant.notebooks.enabled') ??\n false;\n\n return (\n <Routes>\n <Route path=\"/\" element={<LightspeedPage />} />\n <Route\n path=\"/conversation/:conversationId\"\n element={<LightspeedPage />}\n />\n {notebooksEnabled && (\n <>\n <Route path=\"/notebooks\" element={<LightspeedPage />} />\n <Route path=\"/notebooks/:notebookId\" element={<LightspeedPage />} />\n </>\n )}\n </Routes>\n );\n};\n"],"names":[],"mappings":";;;;;AAyBO,MAAM,SAAS,MAAM;AAC1B,EAAA,MAAM,SAAA,GAAY,OAAO,YAAY,CAAA;AACrC,EAAA,MAAM,gBAAA,GACJ,SAAA,CAAU,kBAAA,CAAmB,yCAAyC,CAAA,IACtE,KAAA;AAEF,EAAA,4BACG,MAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAM,IAAA,EAAK,GAAA,EAAI,OAAA,kBAAS,GAAA,CAAC,kBAAe,CAAA,EAAI,CAAA;AAAA,oBAC7C,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,+BAAA;AAAA,QACL,OAAA,sBAAU,cAAA,EAAA,EAAe;AAAA;AAAA,KAC3B;AAAA,IACC,oCACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,SAAM,IAAA,EAAK,YAAA,EAAa,OAAA,kBAAS,GAAA,CAAC,kBAAe,CAAA,EAAI,CAAA;AAAA,0BACrD,KAAA,EAAA,EAAM,IAAA,EAAK,0BAAyB,OAAA,kBAAS,GAAA,CAAC,kBAAe,CAAA,EAAI;AAAA,KAAA,EACpE;AAAA,GAAA,EAEJ,CAAA;AAEJ;;;;"}
@@ -1,85 +1,62 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { makeStyles } from '@material-ui/core';
3
- import { Popover, Button, HelperText, HelperTextItem, List, ListItem, Tooltip } from '@patternfly/react-core';
2
+ import Box from '@mui/material/Box';
3
+ import { styled } from '@mui/material/styles';
4
+ import { Popover, Button, HelperText, List, ListItem, HelperTextItem, Tooltip } from '@patternfly/react-core';
4
5
  import { LinkIcon, InfoCircleIcon } from '@patternfly/react-icons';
5
6
  import { useTranslation } from '../hooks/useTranslation.esm.js';
6
7
  import { FileTypeIcon } from './notebooks/FileTypeIcon.esm.js';
8
+ import { RagSourceLabel } from './RagSourceLabel.esm.js';
7
9
 
8
10
  const POPOVER_WIDTH = "400px";
9
- const useStyles = makeStyles((theme) => ({
10
- sourcesPopover: {
11
- "& .pf-v6-c-popover__title": {
12
- alignItems: "flex-start"
13
- },
14
- "& .pf-v6-c-popover__title-text": {
15
- margin: 0
16
- },
17
- "& .pf-v6-c-popover__header": {
18
- paddingBlockEnd: theme.spacing(2)
19
- },
20
- "& .pf-v6-c-popover__body": {
21
- paddingBlockStart: 0
22
- }
23
- },
24
- chipButton: {
25
- padding: "4px 12px",
26
- fontSize: "0.8125rem",
27
- fontWeight: 500,
28
- borderRadius: 16,
29
- backgroundColor: "transparent",
30
- color: "var(--pf-t--global--text--color--regular, #1b1d21)",
31
- "&:hover": {
32
- backgroundColor: "var(--pf-t--global--background--color--secondary--default, #e0e0e0)"
33
- },
34
- "& .pf-v6-c-button__icon": {
35
- color: "inherit"
36
- }
11
+ const SourcesPopover = styled(Popover)(({ theme }) => ({
12
+ "& .pf-v6-c-popover__title": {
13
+ alignItems: "flex-start"
37
14
  },
38
- helperText: {
39
- marginBottom: theme.spacing(1.5),
40
- color: "var(--pf-t--global--text--color--subtle, #c7c7c7)"
15
+ "& .pf-v6-c-popover__title-text": {
16
+ margin: 0
41
17
  },
42
- sourcesList: {
43
- maxHeight: 320,
44
- overflowY: "auto"
18
+ "& .pf-v6-c-popover__header": {
19
+ paddingBlockEnd: theme.spacing(2)
45
20
  },
46
- sourceItem: {
47
- alignItems: "center",
48
- "& .pf-v6-c-list__item-text": {
49
- minWidth: 0
50
- }
51
- },
52
- sourceContent: {
53
- flex: 1,
54
- minWidth: 0
55
- },
56
- sourceTitle: {
57
- fontSize: "0.875rem",
58
- fontWeight: 500,
59
- overflow: "hidden",
60
- textOverflow: "ellipsis",
61
- whiteSpace: "nowrap"
21
+ "& .pf-v6-c-popover__body": {
22
+ paddingBlockStart: 0
23
+ }
24
+ }));
25
+ const ChipButton = styled(Button)({
26
+ padding: "4px 12px",
27
+ fontSize: "0.8125rem",
28
+ fontWeight: 500,
29
+ borderRadius: 16,
30
+ backgroundColor: "transparent",
31
+ color: "var(--pf-t--global--text--color--regular)",
32
+ "&:hover": {
33
+ backgroundColor: "var(--pf-t--global--background--color--secondary--default)"
62
34
  },
63
- sourceBody: {
64
- fontSize: "0.8125rem",
65
- color: "var(--pf-t--global--text--color--subtle, #c7c7c7)",
66
- marginTop: 2,
67
- overflow: "hidden",
68
- textOverflow: "ellipsis",
69
- display: "-webkit-box",
70
- WebkitLineClamp: 2,
71
- WebkitBoxOrient: "vertical"
35
+ "& .pf-v6-c-button__icon": {
36
+ color: "inherit"
72
37
  }
38
+ });
39
+ const SourcesHelperText = styled(HelperText)(({ theme }) => ({
40
+ marginBottom: theme.spacing(1.5),
41
+ color: "var(--pf-t--global--text--color--subtle)"
73
42
  }));
43
+ const SourcesList = styled(List)({
44
+ maxHeight: 320,
45
+ overflowY: "auto"
46
+ });
47
+ const SourceListItem = styled(ListItem)({
48
+ alignItems: "center",
49
+ "& .pf-v6-c-list__item-text": {
50
+ minWidth: 0
51
+ }
52
+ });
74
53
  const SourcesChipModal = ({ sources }) => {
75
- const classes = useStyles();
76
54
  const { t } = useTranslation();
77
55
  const count = sources.sources?.length ?? 0;
78
56
  if (count === 0) return null;
79
57
  return /* @__PURE__ */ jsx(
80
- Popover,
58
+ SourcesPopover,
81
59
  {
82
- className: classes.sourcesPopover,
83
60
  position: "top-start",
84
61
  triggerAction: "click",
85
62
  "aria-label": t("sources.modal.title"),
@@ -90,32 +67,60 @@ const SourcesChipModal = ({ sources }) => {
90
67
  maxWidth: POPOVER_WIDTH,
91
68
  appendTo: () => document.body,
92
69
  bodyContent: /* @__PURE__ */ jsxs(Fragment, { children: [
93
- /* @__PURE__ */ jsx(HelperText, { className: classes.helperText, children: /* @__PURE__ */ jsx(HelperTextItem, { variant: "indeterminate", icon: /* @__PURE__ */ jsx(InfoCircleIcon, {}), children: t("sources.modal.description") }) }),
94
- /* @__PURE__ */ jsx(
95
- List,
96
- {
97
- isPlain: true,
98
- className: classes.sourcesList,
99
- "aria-label": t("sources.modal.title"),
100
- children: sources.sources.map((source, index) => {
101
- const title = source.title ?? `Source ${index + 1}`;
102
- return /* @__PURE__ */ jsx(
103
- ListItem,
104
- {
105
- className: classes.sourceItem,
106
- icon: /* @__PURE__ */ jsx(FileTypeIcon, { fileName: title }),
107
- children: /* @__PURE__ */ jsxs("div", { className: classes.sourceContent, children: [
108
- /* @__PURE__ */ jsx(Tooltip, { content: title, children: /* @__PURE__ */ jsx("div", { className: classes.sourceTitle, children: title }) }),
109
- source.body && /* @__PURE__ */ jsx("div", { className: classes.sourceBody, children: source.body })
110
- ] })
111
- },
112
- `${source.title}-${index}`
113
- );
114
- })
115
- }
116
- )
70
+ /* @__PURE__ */ jsx(SourcesHelperText, { children: /* @__PURE__ */ jsx(HelperTextItem, { variant: "indeterminate", icon: /* @__PURE__ */ jsx(InfoCircleIcon, {}), children: t("sources.modal.description") }) }),
71
+ /* @__PURE__ */ jsx(SourcesList, { isPlain: true, "aria-label": t("sources.modal.title"), children: sources.sources.map((source, index) => {
72
+ const title = source.title ?? `Source ${index + 1}`;
73
+ const ragSource = source.ragSource;
74
+ const titleNode = /* @__PURE__ */ jsx(
75
+ Box,
76
+ {
77
+ sx: {
78
+ fontSize: "0.875rem",
79
+ fontWeight: 500,
80
+ overflow: "hidden",
81
+ textOverflow: "ellipsis",
82
+ whiteSpace: "nowrap",
83
+ minWidth: 0
84
+ },
85
+ children: title
86
+ }
87
+ );
88
+ return /* @__PURE__ */ jsx(
89
+ SourceListItem,
90
+ {
91
+ icon: /* @__PURE__ */ jsx(FileTypeIcon, { fileName: title }),
92
+ children: /* @__PURE__ */ jsxs(Box, { sx: { flex: 1, minWidth: 0 }, children: [
93
+ /* @__PURE__ */ jsx(Tooltip, { content: title, children: titleNode }),
94
+ ragSource && /* @__PURE__ */ jsx(
95
+ Box,
96
+ {
97
+ sx: { marginTop: "var(--pf-t--global--spacer--xs)" },
98
+ children: /* @__PURE__ */ jsx(RagSourceLabel, { source: ragSource })
99
+ }
100
+ ),
101
+ source.body && /* @__PURE__ */ jsx(
102
+ Box,
103
+ {
104
+ sx: {
105
+ fontSize: "0.8125rem",
106
+ color: "var(--pf-t--global--text--color--subtle)",
107
+ marginTop: "2px",
108
+ overflow: "hidden",
109
+ textOverflow: "ellipsis",
110
+ display: "-webkit-box",
111
+ WebkitLineClamp: 2,
112
+ WebkitBoxOrient: "vertical"
113
+ },
114
+ children: source.body
115
+ }
116
+ )
117
+ ] })
118
+ },
119
+ `${source.title}-${index}`
120
+ );
121
+ }) })
117
122
  ] }),
118
- children: /* @__PURE__ */ jsx(Button, { variant: "link", icon: /* @__PURE__ */ jsx(LinkIcon, {}), className: classes.chipButton, children: t("sources.chip.label", { count }) })
123
+ children: /* @__PURE__ */ jsx(ChipButton, { variant: "link", icon: /* @__PURE__ */ jsx(LinkIcon, {}), children: t("sources.chip.label", { count }) })
119
124
  }
120
125
  );
121
126
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SourcesChipModal.esm.js","sources":["../../src/components/SourcesChipModal.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 { makeStyles } from '@material-ui/core';\nimport { SourcesCardProps } from '@patternfly/chatbot';\nimport {\n Button,\n HelperText,\n HelperTextItem,\n List,\n ListItem,\n Popover,\n Tooltip,\n} from '@patternfly/react-core';\nimport { InfoCircleIcon, LinkIcon } from '@patternfly/react-icons';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport { FileTypeIcon } from './notebooks/FileTypeIcon';\n\nconst POPOVER_WIDTH = '400px';\n\nconst useStyles = makeStyles(theme => ({\n sourcesPopover: {\n '& .pf-v6-c-popover__title': {\n alignItems: 'flex-start',\n },\n '& .pf-v6-c-popover__title-text': {\n margin: 0,\n },\n '& .pf-v6-c-popover__header': {\n paddingBlockEnd: theme.spacing(2),\n },\n '& .pf-v6-c-popover__body': {\n paddingBlockStart: 0,\n },\n },\n chipButton: {\n padding: '4px 12px',\n fontSize: '0.8125rem',\n fontWeight: 500,\n borderRadius: 16,\n backgroundColor: 'transparent',\n color: 'var(--pf-t--global--text--color--regular, #1b1d21)',\n '&:hover': {\n backgroundColor:\n 'var(--pf-t--global--background--color--secondary--default, #e0e0e0)',\n },\n '& .pf-v6-c-button__icon': {\n color: 'inherit',\n },\n },\n helperText: {\n marginBottom: theme.spacing(1.5),\n color: 'var(--pf-t--global--text--color--subtle, #c7c7c7)',\n },\n sourcesList: {\n maxHeight: 320,\n overflowY: 'auto' as const,\n },\n sourceItem: {\n alignItems: 'center',\n '& .pf-v6-c-list__item-text': {\n minWidth: 0,\n },\n },\n sourceContent: {\n flex: 1,\n minWidth: 0,\n },\n sourceTitle: {\n fontSize: '0.875rem',\n fontWeight: 500,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n sourceBody: {\n fontSize: '0.8125rem',\n color: 'var(--pf-t--global--text--color--subtle, #c7c7c7)',\n marginTop: 2,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n },\n}));\n\ntype SourcesChipModalProps = {\n sources: SourcesCardProps;\n};\n\nexport const SourcesChipModal = ({ sources }: SourcesChipModalProps) => {\n const classes = useStyles();\n const { t } = useTranslation();\n\n const count = sources.sources?.length ?? 0;\n if (count === 0) return null;\n\n return (\n <Popover\n className={classes.sourcesPopover}\n position=\"top-start\"\n triggerAction=\"click\"\n aria-label={t('sources.modal.title')}\n headerContent={t('sources.modal.title')}\n headerIcon={<LinkIcon />}\n closeBtnAriaLabel={t('sources.popover.closeAriaLabel')}\n minWidth={POPOVER_WIDTH}\n maxWidth={POPOVER_WIDTH}\n appendTo={() => document.body}\n bodyContent={\n <>\n <HelperText className={classes.helperText}>\n <HelperTextItem variant=\"indeterminate\" icon={<InfoCircleIcon />}>\n {t('sources.modal.description')}\n </HelperTextItem>\n </HelperText>\n <List\n isPlain\n className={classes.sourcesList}\n aria-label={t('sources.modal.title')}\n >\n {sources.sources.map((source, index) => {\n const title = source.title ?? `Source ${index + 1}`;\n return (\n <ListItem\n key={`${source.title}-${index}`}\n className={classes.sourceItem}\n icon={<FileTypeIcon fileName={title} />}\n >\n <div className={classes.sourceContent}>\n <Tooltip content={title}>\n <div className={classes.sourceTitle}>{title}</div>\n </Tooltip>\n {source.body && (\n <div className={classes.sourceBody}>{source.body}</div>\n )}\n </div>\n </ListItem>\n );\n })}\n </List>\n </>\n }\n >\n <Button variant=\"link\" icon={<LinkIcon />} className={classes.chipButton}>\n {(t as Function)('sources.chip.label', { count })}\n </Button>\n </Popover>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAgCA,MAAM,aAAA,GAAgB,OAAA;AAEtB,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,cAAA,EAAgB;AAAA,IACd,2BAAA,EAA6B;AAAA,MAC3B,UAAA,EAAY;AAAA,KACd;AAAA,IACA,gCAAA,EAAkC;AAAA,MAChC,MAAA,EAAQ;AAAA,KACV;AAAA,IACA,4BAAA,EAA8B;AAAA,MAC5B,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,CAAC;AAAA,KAClC;AAAA,IACA,0BAAA,EAA4B;AAAA,MAC1B,iBAAA,EAAmB;AAAA;AACrB,GACF;AAAA,EACA,UAAA,EAAY;AAAA,IACV,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,WAAA;AAAA,I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uBACE,GAAA;AAAA,gBAAC,QAAA;AAAA,gBAAA;AAAA,kBAEC,WAAW,OAAA,CAAQ,UAAA;AAAA,kBACnB,IAAA,kBAAM,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAU,KAAA,EAAO,CAAA;AAAA,kBAErC,QAAA,kBAAA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,aAAA,EACtB,QAAA,EAAA;AAAA,oCAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,SAAS,KAAA,EAChB,QAAA,kBAAA,GAAA,CAAC,SAAI,SAAA,EAAW,OAAA,CAAQ,WAAA,EAAc,QAAA,EAAA,KAAA,EAAM,CAAA,EAC9C,CAAA;AAAA,oBACC,MAAA,CAAO,wBACN,GAAA,CAAC,KAAA,EAAA,EAAI,WAAW,OAAA,CAAQ,UAAA,EAAa,iBAAO,IAAA,EAAK;AAAA,mBAAA,EAErD;AAAA,iBAAA;AAAA,gBAXK,CAAA,EAAG,MAAA,CAAO,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,eAY/B;AAAA,YAEJ,CAAC;AAAA;AAAA;AACH,OAAA,EACF,CAAA;AAAA,MAGF,8BAAC,MAAA,EAAA,EAAO,OAAA,EAAQ,MAAA,EAAO,IAAA,sBAAO,QAAA,EAAA,EAAS,CAAA,EAAI,SAAA,EAAW,OAAA,CAAQ,YAC1D,QAAA,EAAA,CAAA,CAAe,oBAAA,EAAsB,EAAE,KAAA,EAAO,CAAA,EAClD;AAAA;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"SourcesChipModal.esm.js","sources":["../../src/components/SourcesChipModal.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 { styled } from '@mui/material/styles';\nimport { SourcesCardProps } from '@patternfly/chatbot';\nimport {\n Button,\n HelperText,\n HelperTextItem,\n List,\n ListItem,\n Popover,\n Tooltip,\n} from '@patternfly/react-core';\nimport { InfoCircleIcon, LinkIcon } from '@patternfly/react-icons';\n\nimport { useTranslation } from '../hooks/useTranslation';\nimport { SourceWithRagId } from '../utils/lightspeed-chatbox-utils';\nimport { FileTypeIcon } from './notebooks/FileTypeIcon';\nimport { RagSourceLabel } from './RagSourceLabel';\n\nconst POPOVER_WIDTH = '400px';\n\nconst SourcesPopover = styled(Popover)(({ theme }) => ({\n '& .pf-v6-c-popover__title': {\n alignItems: 'flex-start',\n },\n '& .pf-v6-c-popover__title-text': {\n margin: 0,\n },\n '& .pf-v6-c-popover__header': {\n paddingBlockEnd: theme.spacing(2),\n },\n '& .pf-v6-c-popover__body': {\n paddingBlockStart: 0,\n },\n}));\n\nconst ChipButton = styled(Button)({\n padding: '4px 12px',\n fontSize: '0.8125rem',\n fontWeight: 500,\n borderRadius: 16,\n backgroundColor: 'transparent',\n color: 'var(--pf-t--global--text--color--regular)',\n '&:hover': {\n backgroundColor:\n 'var(--pf-t--global--background--color--secondary--default)',\n },\n '& .pf-v6-c-button__icon': {\n color: 'inherit',\n },\n});\n\nconst SourcesHelperText = styled(HelperText)(({ theme }) => ({\n marginBottom: theme.spacing(1.5),\n color: 'var(--pf-t--global--text--color--subtle)',\n}));\n\nconst SourcesList = styled(List)({\n maxHeight: 320,\n overflowY: 'auto',\n});\n\nconst SourceListItem = styled(ListItem)({\n alignItems: 'center',\n '& .pf-v6-c-list__item-text': {\n minWidth: 0,\n },\n});\n\ntype SourcesChipModalProps = {\n sources: SourcesCardProps;\n};\n\nexport const SourcesChipModal = ({ sources }: SourcesChipModalProps) => {\n const { t } = useTranslation();\n\n const count = sources.sources?.length ?? 0;\n if (count === 0) return null;\n\n return (\n <SourcesPopover\n position=\"top-start\"\n triggerAction=\"click\"\n aria-label={t('sources.modal.title')}\n headerContent={t('sources.modal.title')}\n headerIcon={<LinkIcon />}\n closeBtnAriaLabel={t('sources.popover.closeAriaLabel')}\n minWidth={POPOVER_WIDTH}\n maxWidth={POPOVER_WIDTH}\n appendTo={() => document.body}\n bodyContent={\n <>\n <SourcesHelperText>\n <HelperTextItem variant=\"indeterminate\" icon={<InfoCircleIcon />}>\n {t('sources.modal.description')}\n </HelperTextItem>\n </SourcesHelperText>\n <SourcesList isPlain aria-label={t('sources.modal.title')}>\n {sources.sources.map((source, index) => {\n const title = source.title ?? `Source ${index + 1}`;\n const ragSource = (source as SourceWithRagId).ragSource;\n const titleNode = (\n <Box\n sx={{\n fontSize: '0.875rem',\n fontWeight: 500,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n minWidth: 0,\n }}\n >\n {title}\n </Box>\n );\n return (\n <SourceListItem\n key={`${source.title}-${index}`}\n icon={<FileTypeIcon fileName={title} />}\n >\n <Box sx={{ flex: 1, minWidth: 0 }}>\n <Tooltip content={title}>{titleNode}</Tooltip>\n {ragSource && (\n <Box\n sx={{ marginTop: 'var(--pf-t--global--spacer--xs)' }}\n >\n <RagSourceLabel source={ragSource} />\n </Box>\n )}\n {source.body && (\n <Box\n sx={{\n fontSize: '0.8125rem',\n color: 'var(--pf-t--global--text--color--subtle)',\n marginTop: '2px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n }}\n >\n {source.body}\n </Box>\n )}\n </Box>\n </SourceListItem>\n );\n })}\n </SourcesList>\n </>\n }\n >\n <ChipButton variant=\"link\" icon={<LinkIcon />}>\n {(t as Function)('sources.chip.label', { count })}\n </ChipButton>\n </SourcesPopover>\n );\n};\n"],"names":[],"mappings":";;;;;;;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A;AAAA,sBACjB,eAAA,EAAiB;AAAA,qBACnB;AAAA,oBAEC,QAAA,EAAA,MAAA,CAAO;AAAA;AAAA;AACV,eAAA,EAEJ;AAAA,aAAA;AAAA,YA5BK,CAAA,EAAG,MAAA,CAAO,KAAK,CAAA,CAAA,EAAI,KAAK,CAAA;AAAA,WA6B/B;AAAA,QAEJ,CAAC,CAAA,EACH;AAAA,OAAA,EACF,CAAA;AAAA,MAGF,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,MAAA,EAAO,IAAA,kBAAM,GAAA,CAAC,QAAA,EAAA,EAAS,CAAA,EACvC,QAAA,EAAA,CAAA,CAAe,oBAAA,EAAsB,EAAE,KAAA,EAAO,CAAA,EAClD;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -1,55 +1,39 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { makeStyles } from '@material-ui/core';
2
+ import { styled } from '@mui/material/styles';
3
3
  import { AlertGroup, Alert, AlertVariant, AlertActionCloseButton } from '@patternfly/react-core';
4
4
 
5
- const useStyles = makeStyles((theme) => ({
6
- toastAlertGroup: {
7
- "--pf-v6-c-alert-group--m-toast--InsetInlineEnd": `${theme.spacing(2.5)}px`,
8
- "--pf-v6-c-alert-group--m-toast--InsetBlockStart": `${theme.spacing(2.5)}px`,
9
- "--pf-v6-c-alert-group--m-toast--MaxWidth": "350px",
10
- "--pf-v6-c-alert-group--m-toast--ZIndex": "9999"
11
- },
12
- toastAlert: {
13
- maxWidth: "350px",
14
- "& .pf-v6-c-alert__title": {
15
- margin: 0
16
- }
17
- }
5
+ const ToastAlerts = styled(AlertGroup)(() => ({
6
+ "--pf-v6-c-alert-group--m-toast--MaxWidth": "350px !important"
18
7
  }));
8
+ const ToastAlert = styled(Alert)({
9
+ maxWidth: "350px",
10
+ "& .pf-v6-c-alert__title": {
11
+ margin: 0
12
+ }
13
+ });
19
14
  const ToastAlertGroup = ({
20
15
  alerts,
21
16
  onRemoveAlert
22
17
  }) => {
23
- const classes = useStyles();
24
18
  if (alerts.length === 0) return null;
25
- return /* @__PURE__ */ jsx(
26
- AlertGroup,
19
+ return /* @__PURE__ */ jsx(ToastAlerts, { hasAnimations: true, isToast: true, isLiveRegion: true, children: alerts.map(({ key, title, variant }) => /* @__PURE__ */ jsx(
20
+ ToastAlert,
27
21
  {
28
- hasAnimations: true,
29
- isToast: true,
30
- isLiveRegion: true,
31
- className: classes.toastAlertGroup,
32
- children: alerts.map(({ key, title, variant }) => /* @__PURE__ */ jsx(
33
- Alert,
22
+ variant: AlertVariant[variant ?? "success"],
23
+ title,
24
+ timeout: 2e3,
25
+ onTimeout: () => onRemoveAlert(key),
26
+ actionClose: /* @__PURE__ */ jsx(
27
+ AlertActionCloseButton,
34
28
  {
35
- variant: AlertVariant[variant ?? "success"],
36
29
  title,
37
- className: classes.toastAlert,
38
- timeout: 2e3,
39
- onTimeout: () => onRemoveAlert(key),
40
- actionClose: /* @__PURE__ */ jsx(
41
- AlertActionCloseButton,
42
- {
43
- title,
44
- variantLabel: `${variant ?? "success"} alert`,
45
- onClose: () => onRemoveAlert(key)
46
- }
47
- )
48
- },
49
- key
50
- ))
51
- }
52
- );
30
+ variantLabel: `${variant ?? "success"} alert`,
31
+ onClose: () => onRemoveAlert(key)
32
+ }
33
+ )
34
+ },
35
+ key
36
+ )) });
53
37
  };
54
38
 
55
39
  export { ToastAlertGroup };
@@ -1 +1 @@
1
- {"version":3,"file":"ToastAlertGroup.esm.js","sources":["../../src/components/ToastAlertGroup.tsx"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\n\nimport { makeStyles } from '@material-ui/core';\nimport {\n Alert,\n AlertActionCloseButton,\n AlertGroup,\n AlertVariant,\n type AlertProps,\n} from '@patternfly/react-core';\n\nconst useStyles = makeStyles(theme => ({\n toastAlertGroup: {\n '--pf-v6-c-alert-group--m-toast--InsetInlineEnd': `${theme.spacing(2.5)}px`,\n '--pf-v6-c-alert-group--m-toast--InsetBlockStart': `${theme.spacing(2.5)}px`,\n '--pf-v6-c-alert-group--m-toast--MaxWidth': '350px',\n '--pf-v6-c-alert-group--m-toast--ZIndex': '9999',\n },\n toastAlert: {\n maxWidth: '350px',\n '& .pf-v6-c-alert__title': {\n margin: 0,\n },\n },\n}));\n\ntype ToastAlertGroupProps = {\n alerts: Partial<AlertProps>[];\n onRemoveAlert: (key: React.Key) => void;\n};\n\nexport const ToastAlertGroup = ({\n alerts,\n onRemoveAlert,\n}: ToastAlertGroupProps) => {\n const classes = useStyles();\n\n if (alerts.length === 0) return null;\n\n return (\n <AlertGroup\n hasAnimations\n isToast\n isLiveRegion\n className={classes.toastAlertGroup}\n >\n {alerts.map(({ key, title, variant }) => (\n <Alert\n key={key}\n variant={AlertVariant[variant ?? 'success']}\n title={title}\n className={classes.toastAlert}\n timeout={2000}\n onTimeout={() => onRemoveAlert(key as React.Key)}\n actionClose={\n <AlertActionCloseButton\n title={title as string}\n variantLabel={`${variant ?? 'success'} alert`}\n onClose={() => onRemoveAlert(key as React.Key)}\n />\n }\n />\n ))}\n </AlertGroup>\n );\n};\n"],"names":[],"mappings":";;;;AA2BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,eAAA,EAAiB;AAAA,IACf,gDAAA,EAAkD,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAC,CAAA,EAAA,CAAA;AAAA,IACvE,iDAAA,EAAmD,CAAA,EAAG,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAC,CAAA,EAAA,CAAA;A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"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 { styled } from '@mui/material/styles';\nimport {\n Alert,\n AlertActionCloseButton,\n AlertGroup,\n AlertVariant,\n type AlertProps,\n} from '@patternfly/react-core';\n\nconst ToastAlerts = styled(AlertGroup)(() => ({\n '--pf-v6-c-alert-group--m-toast--MaxWidth': '350px !important',\n}));\n\nconst ToastAlert = styled(Alert)({\n maxWidth: '350px',\n '& .pf-v6-c-alert__title': {\n margin: 0,\n },\n});\n\ntype ToastAlertGroupProps = {\n alerts: Partial<AlertProps>[];\n onRemoveAlert: (key: React.Key) => void;\n};\n\nexport const ToastAlertGroup = ({\n alerts,\n onRemoveAlert,\n}: ToastAlertGroupProps) => {\n if (alerts.length === 0) return null;\n\n return (\n <ToastAlerts hasAnimations isToast isLiveRegion>\n {alerts.map(({ key, title, variant }) => (\n <ToastAlert\n key={key}\n variant={AlertVariant[variant ?? 'success']}\n title={title}\n timeout={2000}\n onTimeout={() => onRemoveAlert(key as React.Key)}\n actionClose={\n <AlertActionCloseButton\n title={title as string}\n variantLabel={`${variant ?? 'success'} alert`}\n onClose={() => onRemoveAlert(key as React.Key)}\n />\n }\n />\n ))}\n </ToastAlerts>\n );\n};\n"],"names":[],"mappings":";;;;AAyBA,MAAM,WAAA,GAAc,MAAA,CAAO,UAAU,CAAA,CAAE,OAAO;AAAA,EAC5C,0CAAA,EAA4C;AAC9C,CAAA,CAAE,CAAA;AAEF,MAAM,UAAA,GAAa,MAAA,CAAO,KAAK,CAAA,CAAE;AAAA,EAC/B,QAAA,EAAU,OAAA;AAAA,EACV,yBAAA,EAA2B;AAAA,IACzB,MAAA,EAAQ;AAAA;AAEZ,CAAC,CAAA;AAOM,MAAM,kBAAkB,CAAC;AAAA,EAC9B,MAAA;AAAA,EACA;AACF,CAAA,KAA4B;AAC1B,EAAA,IAAI,MAAA,CAAO,MAAA,KAAW,CAAA,EAAG,OAAO,IAAA;AAEhC,EAAA,uBACE,GAAA,CAAC,WAAA,EAAA,EAAY,aAAA,EAAa,IAAA,EAAC,SAAO,IAAA,EAAC,YAAA,EAAY,IAAA,EAC5C,QAAA,EAAA,MAAA,CAAO,IAAI,CAAC,EAAE,GAAA,EAAK,KAAA,EAAO,SAAQ,qBACjC,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MAEC,OAAA,EAAS,YAAA,CAAa,OAAA,IAAW,SAAS,CAAA;AAAA,MAC1C,KAAA;AAAA,MACA,OAAA,EAAS,GAAA;AAAA,MACT,SAAA,EAAW,MAAM,aAAA,CAAc,GAAgB,CAAA;AAAA,MAC/C,WAAA,kBACE,GAAA;AAAA,QAAC,sBAAA;AAAA,QAAA;AAAA,UACC,KAAA;AAAA,UACA,YAAA,EAAc,CAAA,EAAG,OAAA,IAAW,SAAS,CAAA,MAAA,CAAA;AAAA,UACrC,OAAA,EAAS,MAAM,aAAA,CAAc,GAAgB;AAAA;AAAA;AAC/C,KAAA;AAAA,IAVG;AAAA,GAaR,CAAA,EACH,CAAA;AAEJ;;;;"}