synapse-react-client 4.0.30 → 4.0.31
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/dist/SWC.index.d.ts +4 -0
- package/dist/SWC.index.d.ts.map +1 -1
- package/dist/SWC.index.js +2 -1
- package/dist/SWC.index.js.map +1 -1
- package/dist/assets/illustrations/curie_avatar.svg +52 -0
- package/dist/assets/illustrations/curie_avatar_head.js +91 -0
- package/dist/assets/illustrations/curie_avatar_head.js.map +1 -0
- package/dist/assets/illustrations/curie_avatar_head.svg +21 -0
- package/dist/assets/illustrations/discussions_illustration2.js +96 -0
- package/dist/assets/illustrations/discussions_illustration2.js.map +1 -0
- package/dist/assets/illustrations/discussions_illustration2.svg +17 -0
- package/dist/assets/illustrations/index.d.ts +3 -0
- package/dist/assets/illustrations/index.d.ts.map +1 -1
- package/dist/assets/illustrations/index.js +34 -32
- package/dist/assets/illustrations/index.js.map +1 -1
- package/dist/assets/mui_components/CurieAvatarHead.d.ts +5 -0
- package/dist/assets/mui_components/CurieAvatarHead.d.ts.map +1 -0
- package/dist/assets/mui_components/CurieAvatarHead.js +17 -0
- package/dist/assets/mui_components/CurieAvatarHead.js.map +1 -0
- package/dist/assets/themed_icons/Model.d.ts +3 -0
- package/dist/assets/themed_icons/Model.d.ts.map +1 -0
- package/dist/assets/themed_icons/Model.js +31 -0
- package/dist/assets/themed_icons/Model.js.map +1 -0
- package/dist/assets/themed_icons/index.d.ts +2 -1
- package/dist/assets/themed_icons/index.d.ts.map +1 -1
- package/dist/assets/themed_icons/index.js +19 -18
- package/dist/components/ChallengeDataDownload/ChallengeDataDownload.d.ts.map +1 -1
- package/dist/components/ChallengeDataDownload/ChallengeDataDownload.js +49 -39
- package/dist/components/ChallengeDataDownload/ChallengeDataDownload.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +46 -45
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/utils/DataGridUtils.js +1 -1
- package/dist/components/DataGrid/utils/DataGridUtils.js.map +1 -1
- package/dist/components/EntityFinder/EntityFinder.js +127 -127
- package/dist/components/EntityFinder/EntityFinder.js.map +1 -1
- package/dist/components/EntityFinder/details/view/DetailsView.js +53 -53
- package/dist/components/EntitySidebar/EntitySidebar.css +1 -1
- package/dist/components/EntitySidebar/EntitySidebar.module.js +11 -11
- package/dist/components/EntitySidebar/EntitySidebar.module.js.map +1 -1
- package/dist/components/EntitySidebar/EntitySidebar.module.scss +2 -2
- package/dist/components/EntityTreeTable/EntityTreeTable.d.ts +7 -0
- package/dist/components/EntityTreeTable/EntityTreeTable.d.ts.map +1 -1
- package/dist/components/EntityTreeTable/EntityTreeTable.js +24 -20
- package/dist/components/EntityTreeTable/EntityTreeTable.js.map +1 -1
- package/dist/components/EntityTreeTable/components/CheckboxCell.d.ts +4 -0
- package/dist/components/EntityTreeTable/components/CheckboxCell.d.ts.map +1 -0
- package/dist/components/EntityTreeTable/components/CheckboxCell.js +43 -0
- package/dist/components/EntityTreeTable/components/CheckboxCell.js.map +1 -0
- package/dist/components/EntityTreeTable/components/EntityNameCell.d.ts.map +1 -1
- package/dist/components/EntityTreeTable/components/EntityNameCell.js +10 -9
- package/dist/components/EntityTreeTable/components/EntityNameCell.js.map +1 -1
- package/dist/components/EntityTreeTable/components/EntityTreeTableContext.d.ts +6 -0
- package/dist/components/EntityTreeTable/components/EntityTreeTableContext.d.ts.map +1 -1
- package/dist/components/EntityTreeTable/components/EntityTreeTableContext.js.map +1 -1
- package/dist/components/EntityTreeTable/hooks/useTableColumns.d.ts +1 -1
- package/dist/components/EntityTreeTable/hooks/useTableColumns.d.ts.map +1 -1
- package/dist/components/EntityTreeTable/hooks/useTableColumns.js +49 -39
- package/dist/components/EntityTreeTable/hooks/useTableColumns.js.map +1 -1
- package/dist/components/EntityUpload/EntityUpload.js +6 -6
- package/dist/components/Forum/DiscussionEmpty.css +1 -0
- package/dist/components/Forum/DiscussionEmpty.d.ts +6 -0
- package/dist/components/Forum/DiscussionEmpty.d.ts.map +1 -0
- package/dist/components/Forum/DiscussionEmpty.js +30 -0
- package/dist/components/Forum/DiscussionEmpty.js.map +1 -0
- package/dist/components/Forum/DiscussionEmpty.module.js +10 -0
- package/dist/components/Forum/DiscussionEmpty.module.js.map +1 -0
- package/dist/components/Forum/DiscussionEmpty.module.scss +37 -0
- package/dist/components/Icon/Icon.d.ts.map +1 -1
- package/dist/components/Icon/Icon.js +82 -80
- package/dist/components/Icon/Icon.js.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceGraph.d.ts.map +1 -1
- package/dist/components/ProvenanceGraph/ProvenanceGraph.js +39 -41
- package/dist/components/ProvenanceGraph/ProvenanceGraph.js.map +1 -1
- package/dist/components/SynapseChat/AccessLevelMenu.d.ts.map +1 -1
- package/dist/components/SynapseChat/AccessLevelMenu.js +1 -0
- package/dist/components/SynapseChat/AccessLevelMenu.js.map +1 -1
- package/dist/components/SynapseChat/GridAgentChat.d.ts.map +1 -1
- package/dist/components/SynapseChat/GridAgentChat.js +34 -25
- package/dist/components/SynapseChat/GridAgentChat.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.d.ts +10 -12
- package/dist/components/SynapseChat/SynapseChat.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapseChat.js +106 -103
- package/dist/components/SynapseChat/SynapseChat.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChatInteraction.css +1 -0
- package/dist/components/SynapseChat/SynapseChatInteraction.d.ts +22 -1
- package/dist/components/SynapseChat/SynapseChatInteraction.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapseChatInteraction.js +123 -94
- package/dist/components/SynapseChat/SynapseChatInteraction.js.map +1 -1
- package/dist/components/SynapseChat/SynapseChatInteraction.module.js +8 -0
- package/dist/components/SynapseChat/SynapseChatInteraction.module.js.map +1 -0
- package/dist/components/SynapseChat/SynapseChatInteraction.module.scss +25 -0
- package/dist/components/SynapseChat/SynapseChatMessage.d.ts +16 -1
- package/dist/components/SynapseChat/SynapseChatMessage.d.ts.map +1 -1
- package/dist/components/SynapseChat/SynapseChatMessage.js +25 -11
- package/dist/components/SynapseChat/SynapseChatMessage.js.map +1 -1
- package/dist/components/SynapseChat/components/AddFilesDialog/AddFilesDialog.d.ts +27 -0
- package/dist/components/SynapseChat/components/AddFilesDialog/AddFilesDialog.d.ts.map +1 -0
- package/dist/components/SynapseChat/components/AddFilesDialog/AddFilesDialog.js +79 -0
- package/dist/components/SynapseChat/components/AddFilesDialog/AddFilesDialog.js.map +1 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.css +1 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.d.ts +33 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.d.ts.map +1 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.js +77 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.js.map +1 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.module.js +8 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.module.js.map +1 -0
- package/dist/components/SynapseChat/components/AttachmentChip/AttachmentChip.module.scss +16 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.css +1 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.d.ts +23 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.d.ts.map +1 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.js +24 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.js.map +1 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.module.js +9 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.module.js.map +1 -0
- package/dist/components/SynapseChat/components/ChatAttachmentStrip/ChatAttachmentStrip.module.scss +19 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.css +1 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.d.ts +22 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.d.ts.map +1 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.js +80 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.js.map +1 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.module.js +9 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.module.js.map +1 -0
- package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.module.scss +39 -0
- package/dist/components/SynapseChat/useChatState.d.ts +12 -4
- package/dist/components/SynapseChat/useChatState.d.ts.map +1 -1
- package/dist/components/SynapseChat/useChatState.js +38 -20
- package/dist/components/SynapseChat/useChatState.js.map +1 -1
- package/dist/components/SynapseChat/utils/constants.d.ts +8 -0
- package/dist/components/SynapseChat/utils/constants.d.ts.map +1 -0
- package/dist/components/SynapseChat/utils/constants.js +12 -0
- package/dist/components/SynapseChat/utils/constants.js.map +1 -0
- package/dist/components/SynapseChat/utils/types.d.ts +13 -0
- package/dist/components/SynapseChat/utils/types.d.ts.map +1 -0
- package/dist/components/SynapseChat/utils/types.js +0 -0
- package/dist/components/SynapseTable/datasets/DatasetItemsEditor.js +101 -101
- package/dist/components/SynapseTable/datasets/DatasetItemsEditor.js.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts +1 -0
- package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts.map +1 -1
- package/dist/components/entity/page/action_menu/EntityActionMenu.js +8 -0
- package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
- package/dist/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.js +1 -1
- package/dist/components/entity/page/breadcrumbs/EntityPageBreadcrumbs.js.map +1 -1
- package/dist/components/file/upload/BasicFileHandleUpload.d.ts +35 -4
- package/dist/components/file/upload/BasicFileHandleUpload.d.ts.map +1 -1
- package/dist/components/file/upload/BasicFileHandleUpload.js +22 -16
- package/dist/components/file/upload/BasicFileHandleUpload.js.map +1 -1
- package/dist/components/file/upload/MultiFileUploadProgress.js +6 -6
- package/dist/components/file/upload/UploadFilePanel.d.ts +32 -0
- package/dist/components/file/upload/UploadFilePanel.d.ts.map +1 -1
- package/dist/components/file/upload/UploadFilePanel.js +58 -42
- package/dist/components/file/upload/UploadFilePanel.js.map +1 -1
- package/dist/components/file/upload/validateFileSelection.d.ts +25 -0
- package/dist/components/file/upload/validateFileSelection.d.ts.map +1 -0
- package/dist/components/file/upload/validateFileSelection.js +18 -0
- package/dist/components/file/upload/validateFileSelection.js.map +1 -0
- package/dist/components/menu/DropdownMenu.d.ts +3 -0
- package/dist/components/menu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/menu/DropdownMenu.js +108 -83
- package/dist/components/menu/DropdownMenu.js.map +1 -1
- package/dist/features/curator/dashboard/components/CurationTaskCard.css +1 -1
- package/dist/features/curator/dashboard/components/CurationTaskCard.module.js +13 -13
- package/dist/features/curator/dashboard/components/CurationTaskCard.module.js.map +1 -1
- package/dist/features/curator/dashboard/components/CurationTaskCard.module.scss +2 -1
- package/dist/features/curator/dashboard/components/CurationTaskCardLayout.d.ts.map +1 -1
- package/dist/features/curator/dashboard/components/CurationTaskCardLayout.js +35 -27
- package/dist/features/curator/dashboard/components/CurationTaskCardLayout.js.map +1 -1
- package/dist/mocks/chat/mockChat.d.ts +13 -1
- package/dist/mocks/chat/mockChat.d.ts.map +1 -1
- package/dist/mocks/chat/mockChat.js +34 -9
- package/dist/mocks/chat/mockChat.js.map +1 -1
- package/dist/mocks/msw/handlers/chatHandlers.d.ts +1 -1
- package/dist/mocks/msw/handlers/chatHandlers.d.ts.map +1 -1
- package/dist/mocks/msw/handlers/chatHandlers.js +21 -7
- package/dist/mocks/msw/handlers/chatHandlers.js.map +1 -1
- package/dist/synapse-client/SynapseClient.d.ts +2 -2
- package/dist/synapse-client/SynapseClient.d.ts.map +1 -1
- package/dist/synapse-client/SynapseClient.js.map +1 -1
- package/dist/synapse-queries/KeyFactory.d.ts +10 -1
- package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
- package/dist/synapse-queries/KeyFactory.js +29 -2
- package/dist/synapse-queries/KeyFactory.js.map +1 -1
- package/dist/synapse-queries/asynchronous/usePollAsynchronousJob.d.ts +2 -2
- package/dist/synapse-queries/asynchronous/usePollAsynchronousJob.d.ts.map +1 -1
- package/dist/synapse-queries/asynchronous/usePollAsynchronousJob.js +2 -1
- package/dist/synapse-queries/asynchronous/usePollAsynchronousJob.js.map +1 -1
- package/dist/synapse-queries/chat/useChat.d.ts +3 -2
- package/dist/synapse-queries/chat/useChat.d.ts.map +1 -1
- package/dist/synapse-queries/chat/useChat.js +7 -6
- package/dist/synapse-queries/chat/useChat.js.map +1 -1
- package/dist/synapse-queries/dataaccess/index.d.ts +1 -0
- package/dist/synapse-queries/dataaccess/index.d.ts.map +1 -1
- package/dist/synapse-queries/dataaccess/index.js +4 -3
- package/dist/synapse-queries/dataaccess/useEDuc.d.ts +44 -0
- package/dist/synapse-queries/dataaccess/useEDuc.d.ts.map +1 -0
- package/dist/synapse-queries/dataaccess/useEDuc.js +75 -0
- package/dist/synapse-queries/dataaccess/useEDuc.js.map +1 -0
- package/dist/synapse-queries/featureflags/useGetFeatureFlag.d.ts.map +1 -1
- package/dist/synapse-queries/featureflags/useGetFeatureFlag.js +1 -1
- package/dist/synapse-queries/featureflags/useGetFeatureFlag.js.map +1 -1
- package/dist/synapse-queries/file/useDirectUploadToS3.js +6 -6
- package/dist/synapse-queries/index.js +181 -172
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/SynapseConstants.d.ts +2 -0
- package/dist/utils/SynapseConstants.d.ts.map +1 -1
- package/dist/utils/SynapseConstants.js +122 -120
- package/dist/utils/SynapseConstants.js.map +1 -1
- package/dist/utils/featureflag/FeatureFlags.d.ts +3 -1
- package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
- package/dist/utils/featureflag/FeatureFlags.js +1 -1
- package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
- package/dist/utils/hooks/useUploadFileEntity/useUploadFileEntities.js +5 -5
- package/dist/utils/hooks/useUploadFileEntity/useUploadFiles.js +14 -14
- package/package.json +4 -4
|
@@ -22,6 +22,9 @@ export type DropdownMenuProps = {
|
|
|
22
22
|
variant?: ButtonProps['variant'];
|
|
23
23
|
convertSingleItemToButton?: boolean;
|
|
24
24
|
renderMenuIfNoItems?: boolean;
|
|
25
|
+
paperSx?: SxProps;
|
|
26
|
+
elevation?: number;
|
|
27
|
+
showFileAccessRequestNotice?: boolean;
|
|
25
28
|
};
|
|
26
29
|
/**
|
|
27
30
|
* The DropdownMenu component provides a generic way to compose a MUI dropdown menu.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/DropdownMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAUX,OAAO,
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/DropdownMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EAUX,OAAO,EAIR,MAAM,eAAe,CAAA;AACtB,OAAO,EAEL,UAAU,EAKX,MAAM,OAAO,CAAA;AACd,OAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAiCtD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAE7B,IAAI,EAAE,MAAM,CAAA;IAEZ,IAAI,CAAC,EAAE,QAAQ,CAAA;IAEf,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;IAEjC,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAE9B,KAAK,EAAE,gBAAgB,EAAE,EAAE,CAAA;IAE3B,kBAAkB,EAAE,MAAM,CAAA;IAE1B,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,WAAW,CAAC,EAAE,WAAW,CAAA;IAEzB,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;IAEhC,yBAAyB,CAAC,EAAE,OAAO,CAAA;IAEnC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,2BAA2B,CAAC,EAAE,OAAO,CAAA;CACtC,CAAA;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,kDAuNpD"}
|
|
@@ -1,121 +1,146 @@
|
|
|
1
1
|
import e from "../IconSvg/IconSvg.js";
|
|
2
2
|
import { useId as t, useRef as n, useState as r } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { Fragment as
|
|
3
|
+
import { Box as i, Button as a, ClickAwayListener as o, Divider as s, Fade as c, ListItemIcon as l, ListItemText as u, MenuItem as d, MenuList as f, Paper as p, Popper as m, Tooltip as h, Typography as g } from "@mui/material";
|
|
4
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/menu/DropdownMenu.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
var b = /* @__PURE__ */ v(i, {
|
|
7
|
+
sx: {
|
|
8
|
+
backgroundColor: "#EAF0F5",
|
|
9
|
+
color: "#3B4046",
|
|
10
|
+
padding: "6px 8px",
|
|
11
|
+
borderRadius: "3px",
|
|
12
|
+
marginTop: "8px"
|
|
13
|
+
},
|
|
14
|
+
children: /* @__PURE__ */ y(g, {
|
|
15
|
+
sx: {
|
|
16
|
+
fontSize: "14px",
|
|
17
|
+
fontWeight: "440",
|
|
18
|
+
lineHeight: "20px",
|
|
19
|
+
letterSpacing: "-0.07px"
|
|
20
|
+
},
|
|
21
|
+
children: [/* @__PURE__ */ y("span", {
|
|
22
|
+
style: { fontWeight: "700" },
|
|
23
|
+
children: ["Note:", " "]
|
|
24
|
+
}), "You can add this file to your download list, but you must make an access request before downloading."]
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
function x(x) {
|
|
28
|
+
let { buttonTooltip: S, dropdownButtonText: C, items: w = [], convertSingleItemToButton: T = !0, renderMenuIfNoItems: E = !1, buttonProps: D = {}, variant: O = "outlined", paperSx: k, elevation: A, showFileAccessRequestNotice: j = !1 } = x, M = t(), [N, P] = r(!1), F = n(null), I = w.flat().length;
|
|
29
|
+
if (!E && I === 0) return null;
|
|
30
|
+
if (T && I === 1) {
|
|
31
|
+
let t = w.flat()[0];
|
|
32
|
+
return /* @__PURE__ */ v(a, {
|
|
12
33
|
component: "href" in t ? "a" : "button",
|
|
13
34
|
title: t.tooltipText,
|
|
14
|
-
variant:
|
|
35
|
+
variant: O,
|
|
15
36
|
href: "href" in t ? t.href : void 0,
|
|
16
37
|
rel: "href" in t ? "noopener noreferrer" : void 0,
|
|
17
38
|
onClick: "onClick" in t ? t.onClick : void 0,
|
|
18
39
|
disabled: t.disabled,
|
|
19
|
-
endIcon: t.icon && /* @__PURE__ */
|
|
40
|
+
endIcon: t.icon && /* @__PURE__ */ v(e, {
|
|
20
41
|
icon: t.icon,
|
|
21
42
|
wrap: !1
|
|
22
43
|
}),
|
|
23
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ v(g, {
|
|
24
45
|
variant: "buttonLink",
|
|
25
46
|
children: t.text
|
|
26
47
|
})
|
|
27
48
|
});
|
|
28
49
|
}
|
|
29
|
-
let
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
50
|
+
let L = () => {
|
|
51
|
+
P((e) => !e);
|
|
52
|
+
}, R = (e) => {
|
|
53
|
+
F.current && F.current.contains(e.target) || P(!1);
|
|
33
54
|
};
|
|
34
|
-
function
|
|
35
|
-
e.key === "Tab" ? (e.preventDefault(),
|
|
55
|
+
function z(e) {
|
|
56
|
+
e.key === "Tab" ? (e.preventDefault(), P(!1)) : e.key === "Escape" && P(!1);
|
|
36
57
|
}
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
title:
|
|
58
|
+
return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(h, {
|
|
59
|
+
title: S ? /* @__PURE__ */ v("div", {
|
|
39
60
|
style: { whiteSpace: "pre-line" },
|
|
40
|
-
children:
|
|
61
|
+
children: S
|
|
41
62
|
}) : void 0,
|
|
42
63
|
placement: "top",
|
|
43
|
-
children: /* @__PURE__ */
|
|
44
|
-
variant:
|
|
45
|
-
ref:
|
|
46
|
-
id: `composition-button-${
|
|
47
|
-
"aria-controls":
|
|
48
|
-
"aria-expanded":
|
|
64
|
+
children: /* @__PURE__ */ v("span", { children: /* @__PURE__ */ v(a, {
|
|
65
|
+
variant: O,
|
|
66
|
+
ref: F,
|
|
67
|
+
id: `composition-button-${M}`,
|
|
68
|
+
"aria-controls": N ? `composition-menu-${M}` : void 0,
|
|
69
|
+
"aria-expanded": N ? "true" : void 0,
|
|
49
70
|
"aria-haspopup": "true",
|
|
50
|
-
onClick:
|
|
51
|
-
...
|
|
52
|
-
children: /* @__PURE__ */
|
|
71
|
+
onClick: L,
|
|
72
|
+
...D,
|
|
73
|
+
children: /* @__PURE__ */ v(g, {
|
|
53
74
|
variant: "buttonLink",
|
|
54
|
-
children:
|
|
75
|
+
children: C
|
|
55
76
|
})
|
|
56
77
|
}) })
|
|
57
|
-
}), /* @__PURE__ */
|
|
58
|
-
open:
|
|
59
|
-
anchorEl:
|
|
78
|
+
}), /* @__PURE__ */ v(m, {
|
|
79
|
+
open: N,
|
|
80
|
+
anchorEl: F.current,
|
|
60
81
|
role: void 0,
|
|
61
82
|
placement: "bottom-end",
|
|
62
83
|
transition: !0,
|
|
63
84
|
style: { zIndex: 10 },
|
|
64
|
-
children: ({ TransitionProps: t }) => /* @__PURE__ */
|
|
85
|
+
children: ({ TransitionProps: t }) => /* @__PURE__ */ v(c, {
|
|
65
86
|
...t,
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
children: /* @__PURE__ */ v(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
sx:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
87
|
+
children: /* @__PURE__ */ v(p, {
|
|
88
|
+
elevation: A,
|
|
89
|
+
sx: { ...k },
|
|
90
|
+
children: /* @__PURE__ */ v(o, {
|
|
91
|
+
onClickAway: R,
|
|
92
|
+
children: /* @__PURE__ */ y(i, { children: [/* @__PURE__ */ v(f, {
|
|
93
|
+
autoFocusItem: N,
|
|
94
|
+
id: `composition-menu-${M}`,
|
|
95
|
+
"aria-labelledby": `composition-button-${M}`,
|
|
96
|
+
onKeyDown: z,
|
|
97
|
+
children: w.map((t, n, r) => [t.map((t) => /* @__PURE__ */ v(h, {
|
|
98
|
+
title: t.tooltipText,
|
|
99
|
+
placement: "left",
|
|
100
|
+
children: /* @__PURE__ */ y(d, {
|
|
101
|
+
component: "a",
|
|
102
|
+
sx: {
|
|
103
|
+
"&:hover": { color: "unset" },
|
|
104
|
+
"&:focus": {
|
|
105
|
+
color: "unset",
|
|
106
|
+
textDecoration: "unset"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
disabled: t.disabled,
|
|
110
|
+
href: "href" in t ? t.href : void 0,
|
|
111
|
+
rel: "href" in t ? "noopener noreferrer" : void 0,
|
|
112
|
+
style: { pointerEvents: "auto" },
|
|
113
|
+
onClick: (e) => {
|
|
114
|
+
!t.disabled && "onClick" in t && t.onClick && (P(!1), t.onClick(e));
|
|
115
|
+
},
|
|
116
|
+
children: [t.icon && /* @__PURE__ */ v(l, {
|
|
117
|
+
style: { minWidth: "30px" },
|
|
118
|
+
children: /* @__PURE__ */ v(e, {
|
|
119
|
+
icon: t.icon,
|
|
120
|
+
sx: {
|
|
121
|
+
width: "17px",
|
|
122
|
+
height: "17px",
|
|
123
|
+
...t.iconSx
|
|
124
|
+
},
|
|
125
|
+
wrap: !1
|
|
126
|
+
})
|
|
127
|
+
}), /* @__PURE__ */ v(u, {
|
|
128
|
+
sx: { marginTop: 0 },
|
|
129
|
+
slotProps: { primary: {
|
|
130
|
+
variant: "smallText1",
|
|
131
|
+
sx: t.textSx
|
|
132
|
+
} },
|
|
133
|
+
children: t.text
|
|
134
|
+
})]
|
|
135
|
+
})
|
|
136
|
+
}, t.text)), n < r.length - 1 && /* @__PURE__ */ v(s, {})])
|
|
137
|
+
}), j && /* @__PURE__ */ y(_, { children: [I > 0 && /* @__PURE__ */ v(s, {}), b] })] })
|
|
113
138
|
})
|
|
114
|
-
})
|
|
139
|
+
})
|
|
115
140
|
})
|
|
116
141
|
})] });
|
|
117
142
|
}
|
|
118
143
|
//#endregion
|
|
119
|
-
export {
|
|
144
|
+
export { x as DropdownMenu };
|
|
120
145
|
|
|
121
146
|
//# sourceMappingURL=DropdownMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/menu/DropdownMenu.tsx"],"sourcesContent":["import {\n Button,\n ButtonProps,\n ClickAwayListener,\n Divider,\n Fade,\n ListItemIcon,\n ListItemText,\n MenuItem,\n MenuList,\n Paper,\n Popper,\n SxProps,\n Tooltip,\n Typography,\n} from '@mui/material'\nimport {\n KeyboardEvent,\n MouseEvent,\n SyntheticEvent,\n useId,\n useRef,\n useState,\n} from 'react'\nimport IconSvg, { IconName } from '../IconSvg/IconSvg'\n\n/**\n * Defines a configuration for a particular dropdown menu item\n */\nexport type DropdownMenuItem = {\n /* The text to show on the menu item. */\n text: string\n /* The icon to show for this item in the menu. */\n icon?: IconName\n /* A function invoked upon clicking the item, assuming `disabled` is falsy */\n onClick?: (e: MouseEvent) => void\n /* A link that the item should point to. */\n href?: string\n /* The optional tooltipText to show for this item. Compatible with the `disabled` prop. */\n tooltipText?: string\n /* Whether the item should be disabled from selection. */\n disabled?: boolean\n /* Additional MUI SxProps to pass to the text component */\n textSx?: SxProps\n /* Additional MUI SxProps to pass to the icon component */\n iconSx?: SxProps\n}\n\nexport type DropdownMenuProps = {\n /* Groups of menu items. Each group will be split with a divider. See DropdownMenuItem for per-item configuration */\n items: DropdownMenuItem[][]\n /* The text to show on the dropdown menu button. */\n dropdownButtonText: string\n /* The optional tooltip text for the dropdown menu button. */\n buttonTooltip?: string\n /* Any additional props to pass to the dropdown menu button. */\n buttonProps?: ButtonProps\n /* Optional MUI button variant for the dropdown button (and the single-item button). Default 'outlined'. */\n variant?: ButtonProps['variant']\n /* If true, will render a single action as a standalone button. Default true. */\n convertSingleItemToButton?: boolean\n /* If true, nothing will be rendered if no actions are passed. Default false. */\n renderMenuIfNoItems?: boolean\n}\n\n/**\n * The DropdownMenu component provides a generic way to compose a MUI dropdown menu.\n */\nexport function DropdownMenu(props: DropdownMenuProps) {\n const {\n buttonTooltip,\n dropdownButtonText,\n items = [] as DropdownMenuItem[][],\n convertSingleItemToButton = true,\n renderMenuIfNoItems = false,\n buttonProps = {},\n variant = 'outlined',\n } = props\n\n const dropdownMenuId = useId()\n const [open, setOpen] = useState(false)\n const anchorRef = useRef<HTMLButtonElement>(null)\n\n const numberOfMenuItems = items.flat().length\n\n if (!renderMenuIfNoItems && numberOfMenuItems === 0) {\n // Hide menu if no actions will be in the menu\n return null\n }\n\n if (convertSingleItemToButton && numberOfMenuItems === 1) {\n // If one action is in the menu, show it as a button\n const menuItem = items.flat()[0]\n return (\n <Button\n component={'href' in menuItem ? 'a' : 'button'}\n title={menuItem.tooltipText}\n variant={variant}\n href={'href' in menuItem ? menuItem.href : undefined}\n rel={'href' in menuItem ? 'noopener noreferrer' : undefined}\n onClick={'onClick' in menuItem ? menuItem.onClick : undefined}\n disabled={menuItem.disabled}\n endIcon={menuItem.icon && <IconSvg icon={menuItem.icon} wrap={false} />}\n >\n <Typography variant={'buttonLink'}>{menuItem.text}</Typography>\n </Button>\n )\n }\n\n const handleToggle = () => {\n setOpen(prevOpen => !prevOpen)\n }\n\n const handleClose = (event: Event | SyntheticEvent) => {\n if (\n anchorRef.current &&\n anchorRef.current.contains(event.target as HTMLElement)\n ) {\n return\n }\n\n setOpen(false)\n }\n\n function handleListKeyDown(event: KeyboardEvent) {\n if (event.key === 'Tab') {\n event.preventDefault()\n setOpen(false)\n } else if (event.key === 'Escape') {\n setOpen(false)\n }\n }\n\n return (\n <>\n <Tooltip\n title={\n buttonTooltip ? (\n <div style={{ whiteSpace: 'pre-line' }}>{buttonTooltip}</div>\n ) : undefined\n }\n placement={'top'}\n >\n <span>\n <Button\n variant={variant}\n ref={anchorRef}\n id={`composition-button-${dropdownMenuId}`}\n aria-controls={\n open ? `composition-menu-${dropdownMenuId}` : undefined\n }\n aria-expanded={open ? 'true' : undefined}\n aria-haspopup=\"true\"\n onClick={handleToggle}\n {...buttonProps}\n >\n <Typography variant={'buttonLink'}>{dropdownButtonText}</Typography>\n </Button>\n </span>\n </Tooltip>\n <Popper\n open={open}\n anchorEl={anchorRef.current}\n role={undefined}\n placement=\"bottom-end\"\n transition\n style={{\n // Fixes issue where react-flow (provenance) would appear above the menu\n zIndex: 10,\n }}\n >\n {({ TransitionProps }) => (\n <Fade {...TransitionProps}>\n <Paper>\n <ClickAwayListener onClickAway={handleClose}>\n <MenuList\n autoFocusItem={open}\n id={`composition-menu-${dropdownMenuId}`}\n aria-labelledby={`composition-button-${dropdownMenuId}`}\n onKeyDown={handleListKeyDown}\n >\n {items.map((itemGroup, index, array) => {\n return [\n itemGroup.map(item => {\n return (\n <Tooltip\n key={item.text}\n title={item.tooltipText}\n placement={'left'}\n >\n <MenuItem\n // Always make the component an anchor in case href is defined.\n component=\"a\"\n sx={{\n // Override the anchor-specific state styles, we don't want it to look like an anchor\n '&:hover': {\n color: 'unset',\n },\n '&:focus': {\n color: 'unset',\n textDecoration: 'unset',\n },\n }}\n disabled={item.disabled}\n href={'href' in item ? item.href : undefined}\n rel={\n 'href' in item\n ? 'noopener noreferrer'\n : undefined\n }\n // Allow pointer events on disabled item so tooltip works.\n style={{ pointerEvents: 'auto' }}\n onClick={(e: MouseEvent) => {\n /*\n * Must check if the item is disabled because we set\n * `pointer-events: 'auto'`\n */\n if (\n !item.disabled &&\n 'onClick' in item &&\n item.onClick\n ) {\n setOpen(false)\n item.onClick(e)\n }\n }}\n >\n <ListItemIcon\n style={{\n // MUI has specified a more specific minWidth for ListItemIcon inside a MenuList than\n // we can create with sx, so apply an inline style for this property only.\n minWidth: '30px',\n }}\n >\n {item.icon && (\n <IconSvg\n icon={item.icon}\n sx={{\n width: '17px',\n height: '17px',\n ...item.iconSx,\n }}\n wrap={false}\n />\n )}\n </ListItemIcon>\n <ListItemText\n sx={{ marginTop: 0 }}\n slotProps={{\n primary: {\n variant: 'smallText1',\n sx: item.textSx,\n },\n }}\n >\n {item.text}\n </ListItemText>\n </MenuItem>\n </Tooltip>\n )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QAAQ;UACR,GAAG,EAAK;SACV;SACA,MAAM;QACP,CAAA;OAES,CAAA,GACd,kBAAC,GAAD;QACE,IAAI,EAAE,WAAW,EAAE;QACnB,WAAW,EACT,SAAS;SACP,SAAS;SACT,IAAI,EAAK;QACX,EACF;kBAEC,EAAK;OACM,CAAA,CACN;;KACH,GAxEF,EAAK,IAwEH,CAEZ,GACD,IAAQ,EAAM,SAAS,KAAK,kBAAC,GAAD,CAAU,CAAA,CACxC,CACD;IACO,CAAA;GACO,CAAA,EACd,CAAA;EACH,CAAA;CAEF,CAAA,CACR,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","names":[],"sources":["../../../src/components/menu/DropdownMenu.tsx"],"sourcesContent":["import {\n Button,\n ButtonProps,\n ClickAwayListener,\n Divider,\n Fade,\n ListItemIcon,\n ListItemText,\n MenuItem,\n MenuList,\n Paper,\n Popper,\n SxProps,\n Tooltip,\n Typography,\n Box,\n} from '@mui/material'\nimport {\n KeyboardEvent,\n MouseEvent,\n SyntheticEvent,\n useId,\n useRef,\n useState,\n} from 'react'\nimport IconSvg, { IconName } from '../IconSvg/IconSvg'\n\nconst fileAccessRequestNotice = (\n <Box\n sx={{\n backgroundColor: '#EAF0F5',\n color: '#3B4046',\n padding: '6px 8px',\n borderRadius: '3px',\n marginTop: '8px',\n }}\n >\n <Typography\n sx={{\n fontSize: '14px',\n fontWeight: '440',\n lineHeight: '20px',\n letterSpacing: '-0.07px',\n }}\n >\n <span\n style={{\n fontWeight: '700',\n }}\n >\n Note:{' '}\n </span>\n You can add this file to your download list, but you must make an access\n request before downloading.\n </Typography>\n </Box>\n)\n\n/**\n * Defines a configuration for a particular dropdown menu item\n */\nexport type DropdownMenuItem = {\n /* The text to show on the menu item. */\n text: string\n /* The icon to show for this item in the menu. */\n icon?: IconName\n /* A function invoked upon clicking the item, assuming `disabled` is falsy */\n onClick?: (e: MouseEvent) => void\n /* A link that the item should point to. */\n href?: string\n /* The optional tooltipText to show for this item. Compatible with the `disabled` prop. */\n tooltipText?: string\n /* Whether the item should be disabled from selection. */\n disabled?: boolean\n /* Additional MUI SxProps to pass to the text component */\n textSx?: SxProps\n /* Additional MUI SxProps to pass to the icon component */\n iconSx?: SxProps\n}\n\nexport type DropdownMenuProps = {\n /* Groups of menu items. Each group will be split with a divider. See DropdownMenuItem for per-item configuration */\n items: DropdownMenuItem[][]\n /* The text to show on the dropdown menu button. */\n dropdownButtonText: string\n /* The optional tooltip text for the dropdown menu button. */\n buttonTooltip?: string\n /* Any additional props to pass to the dropdown menu button. */\n buttonProps?: ButtonProps\n /* Optional MUI button variant for the dropdown button (and the single-item button). Default 'outlined'. */\n variant?: ButtonProps['variant']\n /* If true, will render a single action as a standalone button. Default true. */\n convertSingleItemToButton?: boolean\n /* If true, nothing will be rendered if no actions are passed. Default false. */\n renderMenuIfNoItems?: boolean\n paperSx?: SxProps\n elevation?: number\n /* If true, shows the file access request notice at the bottom of the menu. Default false. */\n showFileAccessRequestNotice?: boolean\n}\n\n/**\n * The DropdownMenu component provides a generic way to compose a MUI dropdown menu.\n */\nexport function DropdownMenu(props: DropdownMenuProps) {\n const {\n buttonTooltip,\n dropdownButtonText,\n items = [] as DropdownMenuItem[][],\n convertSingleItemToButton = true,\n renderMenuIfNoItems = false,\n buttonProps = {},\n variant = 'outlined',\n paperSx,\n elevation,\n showFileAccessRequestNotice = false,\n } = props\n\n const dropdownMenuId = useId()\n const [open, setOpen] = useState(false)\n const anchorRef = useRef<HTMLButtonElement>(null)\n\n const numberOfMenuItems = items.flat().length\n\n if (!renderMenuIfNoItems && numberOfMenuItems === 0) {\n // Hide menu if no actions will be in the menu\n return null\n }\n\n if (convertSingleItemToButton && numberOfMenuItems === 1) {\n // If one action is in the menu, show it as a button\n const menuItem = items.flat()[0]\n return (\n <Button\n component={'href' in menuItem ? 'a' : 'button'}\n title={menuItem.tooltipText}\n variant={variant}\n href={'href' in menuItem ? menuItem.href : undefined}\n rel={'href' in menuItem ? 'noopener noreferrer' : undefined}\n onClick={'onClick' in menuItem ? menuItem.onClick : undefined}\n disabled={menuItem.disabled}\n endIcon={menuItem.icon && <IconSvg icon={menuItem.icon} wrap={false} />}\n >\n <Typography variant={'buttonLink'}>{menuItem.text}</Typography>\n </Button>\n )\n }\n\n const handleToggle = () => {\n setOpen(prevOpen => !prevOpen)\n }\n\n const handleClose = (event: Event | SyntheticEvent) => {\n if (\n anchorRef.current &&\n anchorRef.current.contains(event.target as HTMLElement)\n ) {\n return\n }\n\n setOpen(false)\n }\n\n function handleListKeyDown(event: KeyboardEvent) {\n if (event.key === 'Tab') {\n event.preventDefault()\n setOpen(false)\n } else if (event.key === 'Escape') {\n setOpen(false)\n }\n }\n\n return (\n <>\n <Tooltip\n title={\n buttonTooltip ? (\n <div style={{ whiteSpace: 'pre-line' }}>{buttonTooltip}</div>\n ) : undefined\n }\n placement={'top'}\n >\n <span>\n <Button\n variant={variant}\n ref={anchorRef}\n id={`composition-button-${dropdownMenuId}`}\n aria-controls={\n open ? `composition-menu-${dropdownMenuId}` : undefined\n }\n aria-expanded={open ? 'true' : undefined}\n aria-haspopup=\"true\"\n onClick={handleToggle}\n {...buttonProps}\n >\n <Typography variant={'buttonLink'}>{dropdownButtonText}</Typography>\n </Button>\n </span>\n </Tooltip>\n <Popper\n open={open}\n anchorEl={anchorRef.current}\n role={undefined}\n placement=\"bottom-end\"\n transition\n style={{\n // Fixes issue where react-flow (provenance) would appear above the menu\n zIndex: 10,\n }}\n >\n {({ TransitionProps }) => (\n <Fade {...TransitionProps}>\n <Paper elevation={elevation} sx={{ ...paperSx }}>\n <ClickAwayListener onClickAway={handleClose}>\n <Box>\n <MenuList\n autoFocusItem={open}\n id={`composition-menu-${dropdownMenuId}`}\n aria-labelledby={`composition-button-${dropdownMenuId}`}\n onKeyDown={handleListKeyDown}\n >\n {items.map((itemGroup, index, array) => {\n return [\n itemGroup.map(item => {\n return (\n <Tooltip\n key={item.text}\n title={item.tooltipText}\n placement={'left'}\n >\n <MenuItem\n // Always make the component an anchor in case href is defined.\n component=\"a\"\n sx={{\n // Override the anchor-specific state styles, we don't want it to look like an anchor\n '&:hover': {\n color: 'unset',\n },\n '&:focus': {\n color: 'unset',\n textDecoration: 'unset',\n },\n }}\n disabled={item.disabled}\n href={'href' in item ? item.href : undefined}\n rel={\n 'href' in item\n ? 'noopener noreferrer'\n : undefined\n }\n // Allow pointer events on disabled item so tooltip works.\n style={{ pointerEvents: 'auto' }}\n onClick={(e: MouseEvent) => {\n /*\n * Must check if the item is disabled because we set\n * `pointer-events: 'auto'`\n */\n if (\n !item.disabled &&\n 'onClick' in item &&\n item.onClick\n ) {\n setOpen(false)\n item.onClick(e)\n }\n }}\n >\n {item.icon && (\n <ListItemIcon\n style={{\n // MUI has specified a more specific minWidth for ListItemIcon inside a MenuList than\n // we can create with sx, so apply an inline style for this property only.\n minWidth: '30px',\n }}\n >\n <IconSvg\n icon={item.icon}\n sx={{\n width: '17px',\n height: '17px',\n ...item.iconSx,\n }}\n wrap={false}\n />\n </ListItemIcon>\n )}\n <ListItemText\n sx={{ marginTop: 0 }}\n slotProps={{\n primary: {\n variant: 'smallText1',\n sx: item.textSx,\n },\n }}\n >\n {item.text}\n </ListItemText>\n </MenuItem>\n </Tooltip>\n )\n }),\n index < array.length - 1 && <Divider />,\n ]\n })}\n </MenuList>\n {showFileAccessRequestNotice && (\n <>\n {numberOfMenuItems > 0 && <Divider />}\n {fileAccessRequestNotice}\n </>\n )}\n </Box>\n </ClickAwayListener>\n </Paper>\n </Fade>\n )}\n </Popper>\n </>\n )\n}\n"],"mappings":";;;;;AA2BA,IAAM,IACJ,kBAAC,GAAD;CACE,IAAI;EACF,iBAAiB;EACjB,OAAO;EACP,SAAS;EACT,cAAc;EACd,WAAW;CACb;WAEA,kBAAC,GAAD;EACE,IAAI;GACF,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,eAAe;EACjB;YANF,CAQE,kBAAC,QAAD;GACE,OAAO,EACL,YAAY,MACd;aAHF,CA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OAAO;WACP,QAAQ;WACR,GAAG,EAAK;UACV;UACA,MAAM;SACP,CAAA;QACW,CAAA,GAEhB,kBAAC,GAAD;SACE,IAAI,EAAE,WAAW,EAAE;SACnB,WAAW,EACT,SAAS;UACP,SAAS;UACT,IAAI,EAAK;SACX,EACF;mBAEC,EAAK;QACM,CAAA,CACN;;MACH,GAxEF,EAAK,IAwEH,CAEZ,GACD,IAAQ,EAAM,SAAS,KAAK,kBAAC,GAAD,CAAU,CAAA,CACxC,CACD;KACO,CAAA,GACT,KACC,kBAAA,GAAA,EAAA,UAAA,CACG,IAAoB,KAAK,kBAAC,GAAD,CAAU,CAAA,GACnC,CACD,EAAA,CAAA,CAED,EAAA,CAAA;IACY,CAAA;GACd,CAAA;EACH,CAAA;CAEF,CAAA,CACR,EAAA,CAAA;AAEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._card_15ur0_1.MuiCard-root{background-color:#f5f8fa}._cardContent_15ur0_5{flex-direction:row;align-items:stretch;gap:24px;margin-bottom:16px;display:flex}@media (width<=768px){._cardContent_15ur0_5{flex-direction:column}}._mainContent_15ur0_18{flex-direction:column;flex:1;gap:16px;display:flex}._titleChipContainer_15ur0_26{flex-direction:row;align-items:center;gap:16px;display:flex}@media (width<=768px){._titleChipContainer_15ur0_26{flex-direction:column;align-items:flex-start}}._title_15ur0_26{cursor:pointer}._title_15ur0_26:hover{text-decoration:underline}._entityInfo_15ur0_47{gap:8px;display:flex}._statusContainer_15ur0_52{flex-direction:column;justify-content:center;align-items:flex-start;gap:8px;display:flex}._expandedContent_15ur0_60{background-color:#fff;border-radius:4px;flex-direction:column;gap:16px;margin:16px;padding:16px;display:flex}._expandedTopRow_15ur0_70{flex-direction:row;align-items:flex-start;gap:16px;display:flex}._helpLink_15ur0_77{white-space:nowrap;align-items:center;gap:4px;margin-left:auto;font-size:14px;display:inline-flex}._helpIcon_15ur0_86{font-size:16px!important}._userChipContainer_15ur0_90{flex-flow:wrap;align-items:center;gap:16px;display:flex}._buttonContainer_15ur0_98{flex-grow:0;flex-shrink:0;margin-left:auto;display:flex}@media (width<=768px){._buttonContainer_15ur0_98{margin-left:0}}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import './CurationTaskCard.css';var e = {
|
|
2
|
-
card: "
|
|
3
|
-
cardContent: "
|
|
4
|
-
mainContent: "
|
|
5
|
-
titleChipContainer: "
|
|
6
|
-
title: "
|
|
7
|
-
entityInfo: "
|
|
8
|
-
statusContainer: "
|
|
9
|
-
expandedContent: "
|
|
10
|
-
expandedTopRow: "
|
|
11
|
-
helpLink: "
|
|
12
|
-
helpIcon: "
|
|
13
|
-
userChipContainer: "
|
|
14
|
-
buttonContainer: "
|
|
2
|
+
card: "_card_15ur0_1",
|
|
3
|
+
cardContent: "_cardContent_15ur0_5",
|
|
4
|
+
mainContent: "_mainContent_15ur0_18",
|
|
5
|
+
titleChipContainer: "_titleChipContainer_15ur0_26",
|
|
6
|
+
title: "_title_15ur0_26",
|
|
7
|
+
entityInfo: "_entityInfo_15ur0_47",
|
|
8
|
+
statusContainer: "_statusContainer_15ur0_52",
|
|
9
|
+
expandedContent: "_expandedContent_15ur0_60",
|
|
10
|
+
expandedTopRow: "_expandedTopRow_15ur0_70",
|
|
11
|
+
helpLink: "_helpLink_15ur0_77",
|
|
12
|
+
helpIcon: "_helpIcon_15ur0_86",
|
|
13
|
+
userChipContainer: "_userChipContainer_15ur0_90",
|
|
14
|
+
buttonContainer: "_buttonContainer_15ur0_98"
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
17
|
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurationTaskCard.module.js","names":[],"sources":["../../../../../src/features/curator/dashboard/components/CurationTaskCard.module.scss"],"sourcesContent":[".card:global(.MuiCard-root) {\n background-color: #f5f8fa;\n}\n\n.cardContent {\n display: flex;\n flex-direction: row;\n margin-bottom: 16px;\n gap: 24px;\n align-items: stretch;\n\n @media (max-width: 768px) {\n flex-direction: column;\n }\n}\n\n.mainContent {\n display: flex;\n flex-direction: column;\n gap: 16px;\n flex-grow: 1;\n flex: 1;\n}\n\n.titleChipContainer {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 16px;\n align-items: center;\n @media (max-width: 768px) {\n flex-direction: column;\n align-items: flex-start;\n }\n}\n\n.title {\n cursor: pointer;\n\n &:hover {\n text-decoration: underline;\n }\n}\n\n.entityInfo {\n display: flex;\n gap:
|
|
1
|
+
{"version":3,"file":"CurationTaskCard.module.js","names":[],"sources":["../../../../../src/features/curator/dashboard/components/CurationTaskCard.module.scss"],"sourcesContent":[".card:global(.MuiCard-root) {\n background-color: #f5f8fa;\n}\n\n.cardContent {\n display: flex;\n flex-direction: row;\n margin-bottom: 16px;\n gap: 24px;\n align-items: stretch;\n\n @media (max-width: 768px) {\n flex-direction: column;\n }\n}\n\n.mainContent {\n display: flex;\n flex-direction: column;\n gap: 16px;\n flex-grow: 1;\n flex: 1;\n}\n\n.titleChipContainer {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 16px;\n align-items: center;\n @media (max-width: 768px) {\n flex-direction: column;\n align-items: flex-start;\n }\n}\n\n.title {\n cursor: pointer;\n\n &:hover {\n text-decoration: underline;\n }\n}\n\n.entityInfo {\n display: flex;\n gap: 8px;\n}\n\n.statusContainer {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n gap: 8px;\n}\n\n.expandedContent {\n background-color: #fff;\n padding: 16px;\n margin: 16px;\n border-radius: 4px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.expandedTopRow {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 16px;\n}\n\n.helpLink {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n margin-left: auto;\n white-space: nowrap;\n font-size: 14px;\n}\n\n.helpIcon {\n font-size: 16px !important;\n}\n\n.userChipContainer {\n display: flex;\n flex-direction: row;\n gap: 16px;\n align-items: center;\n flex-wrap: wrap;\n}\n\n.buttonContainer {\n display: flex;\n flex-grow: 0;\n flex-shrink: 0;\n margin-left: auto;\n @media (max-width: 768px) {\n margin-left: 0;\n }\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurationTaskCardLayout.d.ts","sourceRoot":"","sources":["../../../../../src/features/curator/dashboard/components/CurationTaskCardLayout.tsx"],"names":[],"mappings":"AAWA,OAAO,EACL,UAAU,EAEX,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"CurationTaskCardLayout.d.ts","sourceRoot":"","sources":["../../../../../src/features/curator/dashboard/components/CurationTaskCardLayout.tsx"],"names":[],"mappings":"AAWA,OAAO,EACL,UAAU,EAEX,MAAM,kCAAkC,CAAA;AAEzC,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAuE3C,MAAM,MAAM,2BAA2B,GAAG;IACxC,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,iGAAiG;IACjG,kBAAkB,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,SAAS,CAAA;CAChE,CAAA;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;;;;EAMxD;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAC5C,KAAK,EAAE,2BAA2B,2CAsGnC"}
|
|
@@ -7,15 +7,16 @@ import a from "./UserOrTeamChip.js";
|
|
|
7
7
|
import { useState as o } from "react";
|
|
8
8
|
import { Card as s, Chip as c, Collapse as l, Divider as u, IconButton as d, Link as f, Skeleton as p, Typography as m } from "@mui/material";
|
|
9
9
|
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
|
-
import {
|
|
11
|
-
import y from "
|
|
12
|
-
import b from "dayjs
|
|
13
|
-
import x from "
|
|
14
|
-
import S from "
|
|
15
|
-
import C from "
|
|
10
|
+
import { TaskStatusStateEnum as v } from "@sage-bionetworks/synapse-client";
|
|
11
|
+
import { useNavigate as y } from "react-router";
|
|
12
|
+
import b from "dayjs";
|
|
13
|
+
import x from "dayjs/plugin/utc";
|
|
14
|
+
import S from "@mui/icons-material/HelpOutline";
|
|
15
|
+
import C from "classnames";
|
|
16
|
+
import w from "@mui/icons-material/SettingsOutlined";
|
|
16
17
|
//#region src/features/curator/dashboard/components/CurationTaskCardLayout.tsx
|
|
17
|
-
|
|
18
|
-
function
|
|
18
|
+
b.extend(x);
|
|
19
|
+
function T(e) {
|
|
19
20
|
let { label: t } = e;
|
|
20
21
|
return /* @__PURE__ */ g(c, {
|
|
21
22
|
sx: {
|
|
@@ -25,7 +26,7 @@ function w(e) {
|
|
|
25
26
|
label: t
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function E(e) {
|
|
29
30
|
let { state: n } = e;
|
|
30
31
|
if (!n) return null;
|
|
31
32
|
let { label: r, backgroundColor: i } = t[n];
|
|
@@ -38,33 +39,37 @@ function T(e) {
|
|
|
38
39
|
label: r
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
let { dueDate: t } = e,
|
|
43
|
-
if (!
|
|
44
|
-
let
|
|
45
|
-
|
|
42
|
+
function D(e) {
|
|
43
|
+
let { dueDate: t, taskState: r } = e, i = n(t);
|
|
44
|
+
if (!i) return null;
|
|
45
|
+
let a = i.format("MM/DD/YY"), o = r === v.COMPLETED || r === v.CANCELED, s = "#E0E0E0";
|
|
46
|
+
if (!o) {
|
|
47
|
+
let e = i.diff(b.utc().startOf("day"), "day");
|
|
48
|
+
e < 0 ? s = "#FFCDD2" : e < 30 && (s = "#FFF9C4");
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ g(c, {
|
|
46
51
|
size: "small",
|
|
47
52
|
sx: {
|
|
48
53
|
fontWeight: 600,
|
|
49
|
-
backgroundColor:
|
|
54
|
+
backgroundColor: s
|
|
50
55
|
},
|
|
51
56
|
label: `Due ${a}`
|
|
52
57
|
});
|
|
53
58
|
}
|
|
54
|
-
function
|
|
59
|
+
function O(e) {
|
|
55
60
|
return {
|
|
56
61
|
title: e?.dataType ?? "",
|
|
57
62
|
description: e?.instructions ?? "",
|
|
58
63
|
principalIds: e?.assigneePrincipalId ? [e.assigneePrincipalId] : []
|
|
59
64
|
};
|
|
60
65
|
}
|
|
61
|
-
function
|
|
62
|
-
let { taskBundle: n, title: c, description:
|
|
66
|
+
function k(t) {
|
|
67
|
+
let { taskBundle: n, title: c, description: v, taskType: b, principalIds: x, renderActionButton: O } = t, k = y(), [A, j] = o(!1), M = n.task?.taskId, N = n.task?.projectId, { data: P } = e(N, void 0, {
|
|
63
68
|
includeEntity: !0,
|
|
64
69
|
includePermissions: !0
|
|
65
70
|
}), F = P?.permissions?.canEdit ?? !1;
|
|
66
71
|
return /* @__PURE__ */ _(s, {
|
|
67
|
-
className:
|
|
72
|
+
className: C(i.card, r.card),
|
|
68
73
|
children: [/* @__PURE__ */ _("div", {
|
|
69
74
|
className: r.cardContent,
|
|
70
75
|
children: [
|
|
@@ -80,11 +85,11 @@ function O(t) {
|
|
|
80
85
|
onClick: () => j(!A),
|
|
81
86
|
children: c
|
|
82
87
|
}),
|
|
83
|
-
b && /* @__PURE__ */ g(
|
|
88
|
+
b && /* @__PURE__ */ g(T, { label: b }),
|
|
84
89
|
F && /* @__PURE__ */ g(d, {
|
|
85
90
|
onClick: () => void k(`edit/${M}`),
|
|
86
91
|
"aria-label": "Task settings",
|
|
87
|
-
children: /* @__PURE__ */ g(
|
|
92
|
+
children: /* @__PURE__ */ g(w, {})
|
|
88
93
|
})
|
|
89
94
|
]
|
|
90
95
|
}),
|
|
@@ -100,13 +105,16 @@ function O(t) {
|
|
|
100
105
|
}),
|
|
101
106
|
/* @__PURE__ */ g("div", {
|
|
102
107
|
className: r.userChipContainer,
|
|
103
|
-
children:
|
|
108
|
+
children: x.map((e) => /* @__PURE__ */ g(a, { principalId: e }, e))
|
|
104
109
|
})
|
|
105
110
|
]
|
|
106
111
|
}),
|
|
107
112
|
/* @__PURE__ */ _("div", {
|
|
108
113
|
className: r.statusContainer,
|
|
109
|
-
children: [/* @__PURE__ */ g(
|
|
114
|
+
children: [/* @__PURE__ */ g(E, { state: n.status?.state }), /* @__PURE__ */ g(D, {
|
|
115
|
+
dueDate: n.status?.dueDate,
|
|
116
|
+
taskState: n.status?.state
|
|
117
|
+
})]
|
|
110
118
|
}),
|
|
111
119
|
!A && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(u, {
|
|
112
120
|
orientation: "vertical",
|
|
@@ -123,9 +131,9 @@ function O(t) {
|
|
|
123
131
|
className: r.expandedContent,
|
|
124
132
|
children: [/* @__PURE__ */ _("div", {
|
|
125
133
|
className: r.expandedTopRow,
|
|
126
|
-
children: [
|
|
134
|
+
children: [v && /* @__PURE__ */ g(m, {
|
|
127
135
|
variant: "body1",
|
|
128
|
-
children:
|
|
136
|
+
children: v
|
|
129
137
|
}), /* @__PURE__ */ _(f, {
|
|
130
138
|
href: "https://docs.synapse.org/synapse-docs/managing-metadata-with-curator",
|
|
131
139
|
target: "_blank",
|
|
@@ -134,7 +142,7 @@ function O(t) {
|
|
|
134
142
|
underline: "hover",
|
|
135
143
|
className: r.helpLink,
|
|
136
144
|
sx: { fontWeight: 400 },
|
|
137
|
-
children: [/* @__PURE__ */ g(
|
|
145
|
+
children: [/* @__PURE__ */ g(S, { className: r.helpIcon }), "Have questions or need help?"]
|
|
138
146
|
})]
|
|
139
147
|
}), O({ expanded: !0 })]
|
|
140
148
|
})
|
|
@@ -142,6 +150,6 @@ function O(t) {
|
|
|
142
150
|
});
|
|
143
151
|
}
|
|
144
152
|
//#endregion
|
|
145
|
-
export {
|
|
153
|
+
export { k as default, O as deriveCardFields };
|
|
146
154
|
|
|
147
155
|
//# sourceMappingURL=CurationTaskCardLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurationTaskCardLayout.js","names":[],"sources":["../../../../../src/features/curator/dashboard/components/CurationTaskCardLayout.tsx"],"sourcesContent":["import {\n Card,\n Chip,\n Collapse,\n Divider,\n IconButton,\n Link,\n Skeleton,\n Typography,\n} from '@mui/material'\nimport HelpOutline from '@mui/icons-material/HelpOutline'\nimport {\n TaskBundle,\n TaskStatusStateEnum,\n} from '@sage-bionetworks/synapse-client'\nimport classNames from 'classnames'\nimport { ReactNode, useState } from 'react'\nimport { useNavigate } from 'react-router'\nimport dayjs from 'dayjs'\nimport utc from 'dayjs/plugin/utc'\nimport SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined'\nimport useGetEntityBundle from '@/synapse-queries/entity/useEntityBundle'\nimport { TASK_STATUS_CONFIG } from '@/features/entity/metadata-task/utils/constants'\nimport { parseDueDate } from '@/features/entity/metadata-task/utils/dueDate'\nimport styles from './CurationTaskCard.module.scss'\nimport sharedStyles from './shared.module.scss'\nimport UserOrTeamChip from './UserOrTeamChip'\n\ndayjs.extend(utc)\n\nfunction TaskTypeChip(props: { label: string }) {\n const { label } = props\n return (\n <Chip sx={{ fontWeight: 600, backgroundColor: '#BFD3ED' }} label={label} />\n )\n}\n\n/**\n * A chip to display CurationTask status.\n *\n * See {@link https://www.figma.com/design/0oPm5lLSUva8kyfVNMS6FA/Sage-Style---Component-Library--SDS-?node-id=4942-1129&m=dev}\n */\nfunction TaskStatusChip(props: { state: TaskStatusStateEnum | undefined }) {\n const { state } = props\n if (!state) return null\n const { label, backgroundColor } = TASK_STATUS_CONFIG[state]\n return (\n <Chip\n size=\"small\"\n sx={{ fontWeight: 600, backgroundColor }}\n label={label}\n />\n )\n}\n\nfunction DueDateChip(props: {
|
|
1
|
+
{"version":3,"file":"CurationTaskCardLayout.js","names":[],"sources":["../../../../../src/features/curator/dashboard/components/CurationTaskCardLayout.tsx"],"sourcesContent":["import {\n Card,\n Chip,\n Collapse,\n Divider,\n IconButton,\n Link,\n Skeleton,\n Typography,\n} from '@mui/material'\nimport HelpOutline from '@mui/icons-material/HelpOutline'\nimport {\n TaskBundle,\n TaskStatusStateEnum,\n} from '@sage-bionetworks/synapse-client'\nimport classNames from 'classnames'\nimport { ReactNode, useState } from 'react'\nimport { useNavigate } from 'react-router'\nimport dayjs from 'dayjs'\nimport utc from 'dayjs/plugin/utc'\nimport SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined'\nimport useGetEntityBundle from '@/synapse-queries/entity/useEntityBundle'\nimport { TASK_STATUS_CONFIG } from '@/features/entity/metadata-task/utils/constants'\nimport { parseDueDate } from '@/features/entity/metadata-task/utils/dueDate'\nimport styles from './CurationTaskCard.module.scss'\nimport sharedStyles from './shared.module.scss'\nimport UserOrTeamChip from './UserOrTeamChip'\n\ndayjs.extend(utc)\n\nfunction TaskTypeChip(props: { label: string }) {\n const { label } = props\n return (\n <Chip sx={{ fontWeight: 600, backgroundColor: '#BFD3ED' }} label={label} />\n )\n}\n\n/**\n * A chip to display CurationTask status.\n *\n * See {@link https://www.figma.com/design/0oPm5lLSUva8kyfVNMS6FA/Sage-Style---Component-Library--SDS-?node-id=4942-1129&m=dev}\n */\nfunction TaskStatusChip(props: { state: TaskStatusStateEnum | undefined }) {\n const { state } = props\n if (!state) return null\n const { label, backgroundColor } = TASK_STATUS_CONFIG[state]\n return (\n <Chip\n size=\"small\"\n sx={{ fontWeight: 600, backgroundColor }}\n label={label}\n />\n )\n}\n\nfunction DueDateChip(props: {\n dueDate: string | undefined\n taskState: TaskStatusStateEnum | undefined\n}) {\n const { dueDate, taskState } = props\n const dueDateObj = parseDueDate(dueDate)\n if (!dueDateObj) return null\n\n const formattedDate = dueDateObj.format('MM/DD/YY')\n const isTerminal =\n taskState === TaskStatusStateEnum.COMPLETED ||\n taskState === TaskStatusStateEnum.CANCELED\n\n let backgroundColor = '#E0E0E0'\n if (!isTerminal) {\n const daysUntilDue = dueDateObj.diff(dayjs.utc().startOf('day'), 'day')\n if (daysUntilDue < 0) {\n backgroundColor = '#FFCDD2'\n } else if (daysUntilDue < 30) {\n backgroundColor = '#FFF9C4'\n }\n }\n\n return (\n <Chip\n size=\"small\"\n sx={{ fontWeight: 600, backgroundColor }}\n label={`Due ${formattedDate}`}\n />\n )\n}\n\nexport type CurationTaskCardLayoutProps = {\n taskBundle: TaskBundle\n title: string\n description: string\n taskType: string\n principalIds: string[]\n /** Renders the action button. `expanded` reflects whether the card is in its expanded layout. */\n renderActionButton: (props: { expanded: boolean }) => ReactNode\n}\n\n/** Derives the fields shared by every card variant from a task's common properties. */\nexport function deriveCardFields(task: TaskBundle['task']) {\n return {\n title: task?.dataType ?? '',\n description: task?.instructions ?? '',\n principalIds: task?.assigneePrincipalId ? [task.assigneePrincipalId] : [],\n }\n}\n\n/**\n * Shared presentational chrome for a curation task card: title, chips, entity info, assignees,\n * status/due date, and an action button slot. Both the grid and executable task cards compose this.\n */\nexport default function CurationTaskCardLayout(\n props: CurationTaskCardLayoutProps,\n) {\n const {\n taskBundle,\n title,\n description,\n taskType,\n principalIds,\n renderActionButton,\n } = props\n\n const navigate = useNavigate()\n const [isExpanded, setIsExpanded] = useState(false)\n\n const taskId = taskBundle.task?.taskId\n const projectId = taskBundle.task?.projectId\n const { data: bundle } = useGetEntityBundle(projectId, undefined, {\n includeEntity: true,\n includePermissions: true,\n })\n const canEdit = bundle?.permissions?.canEdit ?? false\n\n return (\n <Card className={classNames(sharedStyles.card, styles.card)}>\n <div className={styles.cardContent}>\n <div className={styles.mainContent}>\n <div className={styles.titleChipContainer}>\n <Typography\n variant=\"headline3\"\n className={styles.title}\n onClick={() => setIsExpanded(!isExpanded)}\n >\n {title}\n </Typography>\n {taskType && <TaskTypeChip label={taskType} />}\n {canEdit && (\n <IconButton\n onClick={() => void navigate(`edit/${taskId}`)}\n aria-label=\"Task settings\"\n >\n <SettingsOutlinedIcon />\n </IconButton>\n )}\n </div>\n <div className={styles.entityInfo}>\n {bundle?.entity?.name ? (\n <Typography variant=\"body1\">{bundle.entity.name}</Typography>\n ) : (\n <Skeleton width={100} />\n )}\n {taskId && (\n <Typography variant=\"body1\">Task ID: {taskId}</Typography>\n )}\n </div>\n <div className={styles.userChipContainer}>\n {principalIds.map(principalId => (\n <UserOrTeamChip key={principalId} principalId={principalId} />\n ))}\n </div>\n </div>\n <div className={styles.statusContainer}>\n <TaskStatusChip state={taskBundle.status?.state} />\n <DueDateChip\n dueDate={taskBundle.status?.dueDate}\n taskState={taskBundle.status?.state}\n />\n </div>\n {!isExpanded && (\n <>\n <Divider\n orientation=\"vertical\"\n flexItem\n sx={{ display: { xs: 'none', md: 'block' } }}\n />\n {renderActionButton({ expanded: false })}\n </>\n )}\n </div>\n <Collapse in={isExpanded}>\n <div className={styles.expandedContent}>\n <div className={styles.expandedTopRow}>\n {description && (\n <Typography variant=\"body1\">{description}</Typography>\n )}\n <Link\n href=\"https://docs.synapse.org/synapse-docs/managing-metadata-with-curator\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n color=\"text.primary\"\n underline=\"hover\"\n className={styles.helpLink}\n sx={{ fontWeight: 400 }}\n >\n <HelpOutline className={styles.helpIcon} />\n Have questions or need help?\n </Link>\n </div>\n {renderActionButton({ expanded: true })}\n </div>\n </Collapse>\n </Card>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,EAAM,OAAO,CAAG;AAEhB,SAAS,EAAa,GAA0B;CAC9C,IAAM,EAAE,aAAU;CAClB,OACE,kBAAC,GAAD;EAAM,IAAI;GAAE,YAAY;GAAK,iBAAiB;EAAU;EAAU;CAAQ,CAAA;AAE9E;AAOA,SAAS,EAAe,GAAmD;CACzE,IAAM,EAAE,aAAU;CAClB,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,EAAE,UAAO,uBAAoB,EA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kBAAC,GAAD;MACE,MAAK;MACL,QAAO;MACP,KAAI;MACJ,OAAM;MACN,WAAU;MACV,WAAW,EAAO;MAClB,IAAI,EAAE,YAAY,IAAI;gBAPxB,CASE,kBAAC,GAAD,EAAa,WAAW,EAAO,SAAW,CAAA,GAAC,8BAEvC;OACH;QACJ,EAAmB,EAAE,UAAU,GAAK,CAAC,CACnC;;EACG,CAAA,CACN;;AAEV"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatAttachment } from '@/components/SynapseChat/utils/types';
|
|
2
|
+
import { AgentChatRequest, AgentChatResponse } from '@sage-bionetworks/synapse-client';
|
|
3
|
+
import { AgentSession, AsynchronousJobStatus, CreateAgentSessionRequest, ListAgentSessionsRequest, ListAgentSessionsResponse, SessionHistoryResponse, TraceEventsResponse } from '@sage-bionetworks/synapse-types';
|
|
2
4
|
export declare const mockChatSessionId = "session-456";
|
|
3
5
|
export declare const mockCreateAgentSessionRequest: CreateAgentSessionRequest;
|
|
4
6
|
export declare const mockAgentSession: AgentSession;
|
|
@@ -7,9 +9,19 @@ export declare const mockListAgentSessionsRequest: ListAgentSessionsRequest;
|
|
|
7
9
|
export declare const mockListAgentSessionsResponse: ListAgentSessionsResponse;
|
|
8
10
|
export declare const mockAgentChatRequest: AgentChatRequest;
|
|
9
11
|
export declare const mockAgentChatResponse: AgentChatResponse;
|
|
12
|
+
/**
|
|
13
|
+
* Builds a full `AsynchronousJobStatus` for the chat async job, for tests/stories that poll the
|
|
14
|
+
* job status endpoint directly (e.g. to exercise the PROCESSING state). `jobId` is required since
|
|
15
|
+
* it must match the id returned by the mocked start-chat-async endpoint; other fields default to
|
|
16
|
+
* placeholder values and can be overridden.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mockChatJobStatus(overrides: Partial<AsynchronousJobStatus<AgentChatRequest, AgentChatResponse>> & {
|
|
19
|
+
jobId: string;
|
|
20
|
+
}): AsynchronousJobStatus<AgentChatRequest, AgentChatResponse>;
|
|
10
21
|
export declare const mockSessionHistoryResponse: SessionHistoryResponse;
|
|
11
22
|
export declare const mockTraceEventsResponse1: TraceEventsResponse;
|
|
12
23
|
export declare const mockTraceEventsResponse2: TraceEventsResponse;
|
|
13
24
|
export declare const mockTraceEventsResponse3: TraceEventsResponse;
|
|
14
25
|
export declare const mockEmptyTraceEventsResponse: TraceEventsResponse;
|
|
26
|
+
export declare function mockChatAttachment(overrides?: Partial<ChatAttachment>): ChatAttachment;
|
|
15
27
|
//# sourceMappingURL=mockChat.d.ts.map
|