@cccsaurora/clue-ui 1.2.1-patch.256 → 1.3.0-dev.255
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/ActionForm-C0aE9HUv.js +5941 -0
- package/AnnotationDetails-CEou0vCc.js +175 -0
- package/AnnotationPreview-CLMVD6Ec.js +188 -0
- package/ClueEnrichContext-BkD9ZwM9.js +541 -0
- package/FlexOne-BSYAhhtG.js +9 -0
- package/_MapCache-WmuDdwuH.js +222 -0
- package/_Uint8Array-DdG4KLKn.js +128 -0
- package/_baseAssignValue-CGTuELqU.js +25 -0
- package/_baseClone-BpWiBnMp.js +283 -0
- package/_baseExtremum-BY663UjY.js +33 -0
- package/_baseFlatten-B69cDsaV.js +92 -0
- package/_baseGet-Bx3A4Qfp.js +108 -0
- package/_baseIsEqual-B4IufFlL.js +208 -0
- package/_baseIteratee-7AQvAy1o.js +126 -0
- package/_baseSlice-GAv_YFTT.js +20 -0
- package/_baseSum-D0WC1dN0.js +13 -0
- package/_baseUniq-B8fK6hI-.js +115 -0
- package/_commonjsHelpers-DWwsNxpa.js +8 -0
- package/_createAggregator-CwGPThny.js +63 -0
- package/_getPrototype-CblfEidB.js +5 -0
- package/_getTag-jwz4XLoZ.js +126 -0
- package/_setToArray-CaPKQhcz.js +33 -0
- package/cloneDeep-DmUylbkM.js +8 -0
- package/components/AnnotationBody.js +49 -35
- package/components/AnnotationDetailPopover.js +36 -30
- package/components/AnnotationDetails.js +7 -7
- package/components/AnnotationEntry.js +35 -35
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +110 -97
- package/components/EnrichedChip.js +130 -105
- package/components/EnrichedTypography.js +133 -107
- package/components/ErrorBoundary.js +28 -24
- package/components/RetryFailedEnrichments.js +10 -9
- package/components/SourcePicker.js +57 -49
- package/components/actions/ActionForm.js +4 -4
- package/components/actions/ExecutePopover.js +75 -59
- package/components/actions/ResultModal.js +4 -4
- package/components/actions/form/schemaAdapter.js +39 -23
- package/components/actions/formats/FileResult.js +86 -59
- package/components/actions/formats/index.js +21 -10
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +111 -91
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +261 -202
- package/components/display/graph/visualizations/Leaf.js +88 -69
- package/components/display/graph/visualizations/cloud/index.js +98 -81
- package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
- package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
- package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
- package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
- package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
- package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
- package/components/display/graph/visualizations/icons/index.js +14 -13
- package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
- package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
- package/components/display/graph/visualizations/tree/Triangle.js +13 -13
- package/components/display/graph/visualizations/tree/index.js +407 -306
- package/components/display/icons/Iconified.js +27 -12
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/index.js +8678 -5770
- package/components/enrichment/EnrichPopover.js +54 -46
- package/components/fetchers/Fetcher.js +155 -117
- package/components/fetchers/PreviewModal.js +20 -17
- package/components/fetchers/StatusChip.js +21 -17
- package/components/group/Entry.js +13 -11
- package/components/group/Group.js +13 -10
- package/components/group/GroupControl.js +76 -65
- package/components/stats/QueryStatus.js +43 -33
- package/countBy-DqlU5OwT.js +14 -0
- package/data/event.js +6 -4
- package/database/index.js +2 -2
- package/debounce-bV0h5FC5.js +92 -0
- package/get-DSsNkRQs.js +8 -0
- package/groupBy-ChDRT7uy.js +14 -0
- package/hooks/ClueActionContext.js +6 -6
- package/hooks/ClueComponentContext.js +29 -23
- package/hooks/ClueConfigProvider.js +14 -12
- package/hooks/ClueDatabaseContext.js +19 -13
- package/hooks/ClueEnrichContext.js +8 -8
- package/hooks/ClueFetcherContext.js +83 -56
- package/hooks/ClueGroupContext.js +17 -14
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +12 -10
- package/hooks/selectors.js +7 -7
- package/hooks/useActionResult.js +2 -2
- package/hooks/useAnnotations.js +47 -31
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +6 -4
- package/hooks/useClueTypeConfig.js +3 -3
- package/hooks/useComparator.js +722 -435
- package/hooks/useErrors.js +22 -18
- package/hooks/useFetcherResult.js +33 -24
- package/hooks/useMyHighlights.js +66 -36
- package/hooks/useMyLocalStorage.js +66 -37
- package/iconify-CXMreGTg.js +1782 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +84 -69
- package/icons/Context.js +77 -63
- package/icons/Opinion.js +78 -60
- package/icons/iconMap.js +2 -2
- package/identity-CPGTqrE4.js +6 -0
- package/index-AMfoEg_6.js +696 -0
- package/index-B6C2a_Lg.js +1172 -0
- package/index-C12gPw2W.js +17698 -0
- package/index-DCKkHTvx.js +15750 -0
- package/index-UkW8Sur3.js +465 -0
- package/isNil-CIubwp4T.js +6 -0
- package/isObject-FTY-5JQX.js +7 -0
- package/isObjectLike-OAgjjZye.js +48 -0
- package/isSymbol-Xd2FsJyp.js +8 -0
- package/last-CUCl67Im.js +7 -0
- package/main.js +60 -60
- package/package.json +1 -1
- package/sortBy-C7mGPI_D.js +100 -0
- package/sumBy-CGALjmwQ.js +8 -0
- package/text/Frequency.js +42 -23
- package/toFinite-Bc55msYj.js +16 -0
- package/toNumber-DPxy1FBy.js +39 -0
- package/useClueTypeConfig-D2tf4-NM.js +3289 -0
- package/utils/chain.js +91 -65
- package/utils/classificationParser.js +519 -256
- package/utils/constants.js +35 -10
- package/utils/graph.js +72 -45
- package/utils/hashUtil.js +7 -7
- package/utils/line.js +131 -81
- package/utils/loggerUtil.js +5 -3
- package/utils/sessionStorage.js +41 -27
- package/utils/time.js +423 -423
- package/utils/utils.js +9 -9
- package/utils/window.js +21 -10
- package/utils-71DpzFrA.js +199 -0
- package/ActionForm-DlOXqMUx.js +0 -4460
- package/AnnotationDetails-Bk-p0F6h.js +0 -160
- package/AnnotationPreview-jzZvkCxJ.js +0 -140
- package/ClueEnrichContext-KqRuuWNS.js +0 -418
- package/FlexOne-BXWFOd1T.js +0 -6
- package/_MapCache-BiTi0iqu.js +0 -180
- package/_Uint8Array-BQNOM9Rr.js +0 -101
- package/_baseAssignValue-CNMLQZco.js +0 -20
- package/_baseClone-BnT-6pyM.js +0 -207
- package/_baseExtremum-Ca2EHgy2.js +0 -16
- package/_baseFlatten-Bfr_Molw.js +0 -72
- package/_baseGet-DSZygzyq.js +0 -79
- package/_baseIsEqual-VgvaAFZG.js +0 -147
- package/_baseIteratee-Dbfsw5z8.js +0 -95
- package/_baseSlice-M5RKzt1A.js +0 -10
- package/_baseSum-wEbgNeUs.js +0 -10
- package/_baseUniq-BJcj69PL.js +0 -79
- package/_commonjsHelpers-DaMA6jEr.js +0 -8
- package/_createAggregator-k3TuAnxT.js +0 -53
- package/_getPrototype-Cr1Mk7BC.js +0 -5
- package/_getTag-CK2Sffaq.js +0 -90
- package/_isIterateeCall-DkJP7Rbx.js +0 -13
- package/_setToArray-C7yMOeww.js +0 -29
- package/cloneDeep-CF8TtLHr.js +0 -8
- package/countBy-CdYegFSu.js +0 -8
- package/debounce-DryYcbJ4.js +0 -56
- package/get-CH7kz5Ix.js +0 -8
- package/groupBy-br8xmD2R.js +0 -8
- package/iconify-BBckr5AQ.js +0 -1263
- package/identity-ByMq8VxU.js +0 -6
- package/index-BHAe_V9n.js +0 -12768
- package/index-BK-zfYhR.js +0 -358
- package/index-CA5CUNZO.js +0 -975
- package/index-Dj5C04IX.js +0 -568
- package/index-p5_wX7q1.js +0 -11729
- package/isNil-CjWwlQS3.js +0 -6
- package/isObject-B53jY8Qg.js +0 -7
- package/isObjectLike-BatpeCIi.js +0 -29
- package/isSymbol-C3_SC0Qp.js +0 -8
- package/last-7CdUxN0r.js +0 -7
- package/maxBy-Bc0dYHcO.js +0 -8
- package/sortBy-DY2JBf9n.js +0 -75
- package/sumBy-DuMASLPd.js +0 -8
- package/toFinite-BMy6GObD.js +0 -14
- package/toNumber-YVhnnJv4.js +0 -31
- package/useClueTypeConfig-Ct9Ygter.js +0 -2292
- package/utils-DmwSUrum.js +0 -129
package/components/CountBadge.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { Badge
|
|
3
|
-
import { forwardRef
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ref: o,
|
|
8
|
-
...e,
|
|
9
|
-
badgeContent: t < 100 ? t : "99+",
|
|
10
|
-
color: a,
|
|
11
|
-
sx: (i) => ({
|
|
12
|
-
"& .MuiBadge-badge": {
|
|
13
|
-
backgroundColor: "transparent",
|
|
14
|
-
color: i.palette[a].main,
|
|
15
|
-
fontWeight: "bold",
|
|
16
|
-
right: 0,
|
|
17
|
-
top: 0,
|
|
18
|
-
transform: `translateY(-25%) translateX(${Math.min(Math.ceil(Math.log10(t)), 3) * 10}%)`,
|
|
19
|
-
px: 0,
|
|
20
|
-
fontSize: ".85rem"
|
|
21
|
-
},
|
|
22
|
-
pr: 1.5
|
|
23
|
-
}),
|
|
24
|
-
children: r
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from "@mui/material";
|
|
3
|
+
import { forwardRef, cloneElement, Children } from "react";
|
|
4
|
+
const CountBadge = forwardRef(({ children, color = "primary", count, disabled, ...props }, ref) => {
|
|
5
|
+
if (disabled) {
|
|
6
|
+
return cloneElement(Children.only(children), { ref, ...props });
|
|
25
7
|
}
|
|
26
|
-
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Badge,
|
|
10
|
+
{
|
|
11
|
+
ref,
|
|
12
|
+
...props,
|
|
13
|
+
badgeContent: count < 100 ? count : "99+",
|
|
14
|
+
color,
|
|
15
|
+
sx: (theme) => ({
|
|
16
|
+
"& .MuiBadge-badge": {
|
|
17
|
+
backgroundColor: "transparent",
|
|
18
|
+
color: theme.palette[color].main,
|
|
19
|
+
fontWeight: "bold",
|
|
20
|
+
right: 0,
|
|
21
|
+
top: 0,
|
|
22
|
+
transform: `translateY(-25%) translateX(${Math.min(Math.ceil(Math.log10(count)), 3) * 10}%)`,
|
|
23
|
+
px: 0,
|
|
24
|
+
fontSize: ".85rem"
|
|
25
|
+
},
|
|
26
|
+
pr: 1.5
|
|
27
|
+
}),
|
|
28
|
+
children
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
});
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
CountBadge as default
|
|
29
34
|
};
|
|
@@ -1,155 +1,168 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { I as
|
|
3
|
-
import { useTheme
|
|
4
|
-
import { ClueComponentContext
|
|
5
|
-
import { b as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { ICON_MAP
|
|
12
|
-
import
|
|
13
|
-
import { u as
|
|
14
|
-
import { memo
|
|
15
|
-
import { u as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
const
|
|
20
|
-
type
|
|
21
|
-
value
|
|
22
|
-
classification:
|
|
23
|
-
contextIcon
|
|
24
|
-
counters
|
|
25
|
-
hideLoading
|
|
26
|
-
...
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { I as Icon } from "../iconify-CXMreGTg.js";
|
|
3
|
+
import { useTheme, Card, CardHeader, Stack, CircularProgress, Divider, CardContent, Grid, Chip, Typography, Tooltip, Box } from "@mui/material";
|
|
4
|
+
import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
|
|
5
|
+
import { b as useClueEnrichSelector } from "../ActionForm-C0aE9HUv.js";
|
|
6
|
+
import useAnnotations from "../hooks/useAnnotations.js";
|
|
7
|
+
import useErrors from "../hooks/useErrors.js";
|
|
8
|
+
import AssessmentIcon from "../icons/Assessment.js";
|
|
9
|
+
import ContextIcon from "../icons/Context.js";
|
|
10
|
+
import OpinionIcon from "../icons/Opinion.js";
|
|
11
|
+
import { ICON_MAP } from "../icons/iconMap.js";
|
|
12
|
+
import FrequencyText from "../text/Frequency.js";
|
|
13
|
+
import { u as uniq } from "../useClueTypeConfig-D2tf4-NM.js";
|
|
14
|
+
import { memo, useState, useMemo, useCallback } from "react";
|
|
15
|
+
import { u as useContextSelector } from "../index-AMfoEg_6.js";
|
|
16
|
+
import AnnotationEntry from "./AnnotationEntry.js";
|
|
17
|
+
import ExecutePopover from "./actions/ExecutePopover.js";
|
|
18
|
+
import EnrichPopover from "./enrichment/EnrichPopover.js";
|
|
19
|
+
const EnrichedCard = ({
|
|
20
|
+
type,
|
|
21
|
+
value,
|
|
22
|
+
classification: _classification,
|
|
23
|
+
contextIcon = false,
|
|
24
|
+
counters = false,
|
|
25
|
+
hideLoading = false,
|
|
26
|
+
...otherProps
|
|
27
27
|
}) => {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
const theme = useTheme();
|
|
29
|
+
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
30
|
+
const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
|
|
31
|
+
const enrich = useClueEnrichSelector((state) => state.enrich);
|
|
32
|
+
const [filter, setFilter] = useState("all");
|
|
33
|
+
const classification = useMemo(
|
|
34
|
+
() => _classification ?? defaultClassification,
|
|
35
|
+
[_classification, defaultClassification]
|
|
36
|
+
);
|
|
37
|
+
const [annotations, loading] = useAnnotations(type, value, classification);
|
|
38
|
+
const errors = useErrors(value);
|
|
39
|
+
const enrichRequest = { type, value, classification };
|
|
40
|
+
const options = useMemo(() => ["all", ...uniq(annotations.map((annotation) => annotation.type))], [annotations]);
|
|
41
|
+
const forceEnrich = useCallback(() => {
|
|
42
|
+
return enrich(type, value, {
|
|
43
|
+
classification,
|
|
44
|
+
timeout: 15,
|
|
45
|
+
force: true
|
|
46
|
+
});
|
|
47
|
+
}, [classification, enrich, type, value]);
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
Card,
|
|
38
50
|
{
|
|
39
51
|
sx: [
|
|
40
52
|
{
|
|
41
53
|
maxWidth: "900px"
|
|
42
54
|
},
|
|
43
|
-
...Array.isArray(
|
|
55
|
+
...Array.isArray(otherProps == null ? void 0 : otherProps.sx) ? otherProps == null ? void 0 : otherProps.sx : [otherProps == null ? void 0 : otherProps.sx]
|
|
44
56
|
],
|
|
45
|
-
...
|
|
57
|
+
...otherProps,
|
|
46
58
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
CardHeader,
|
|
49
61
|
{
|
|
50
|
-
title: /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
62
|
+
title: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(FrequencyText, { annotations, value, variant: "h6" }),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
AssessmentIcon,
|
|
54
66
|
{
|
|
55
|
-
value:
|
|
56
|
-
annotations
|
|
57
|
-
counters
|
|
67
|
+
value: enrichRequest,
|
|
68
|
+
annotations,
|
|
69
|
+
counters,
|
|
58
70
|
fontSize: "1em",
|
|
59
|
-
disableTooltip:
|
|
71
|
+
disableTooltip: true
|
|
60
72
|
}
|
|
61
73
|
),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
OpinionIcon,
|
|
64
76
|
{
|
|
65
|
-
value:
|
|
66
|
-
annotations
|
|
67
|
-
counters
|
|
77
|
+
value: enrichRequest,
|
|
78
|
+
annotations,
|
|
79
|
+
counters,
|
|
68
80
|
fontSize: "1em",
|
|
69
|
-
disableTooltip:
|
|
81
|
+
disableTooltip: true
|
|
70
82
|
}
|
|
71
83
|
),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
84
|
+
/* @__PURE__ */ jsx(
|
|
85
|
+
ContextIcon,
|
|
74
86
|
{
|
|
75
|
-
value:
|
|
76
|
-
annotations
|
|
77
|
-
counters
|
|
78
|
-
showExtraIcon:
|
|
87
|
+
value: enrichRequest,
|
|
88
|
+
annotations,
|
|
89
|
+
counters,
|
|
90
|
+
showExtraIcon: contextIcon,
|
|
79
91
|
fontSize: "inherit",
|
|
80
|
-
disableTooltip:
|
|
92
|
+
disableTooltip: true
|
|
81
93
|
}
|
|
82
94
|
),
|
|
83
|
-
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */
|
|
95
|
+
loading && !hideLoading && /* @__PURE__ */ jsx(CircularProgress, { color: "primary", size: 18 }),
|
|
96
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
97
|
+
/* @__PURE__ */ jsx(EnrichPopover, { selector: enrichRequest }),
|
|
98
|
+
/* @__PURE__ */ jsx(ExecutePopover, { selectors: [enrichRequest] })
|
|
87
99
|
] })
|
|
88
100
|
}
|
|
89
101
|
),
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
|
|
102
|
+
/* @__PURE__ */ jsx(Divider, { sx: { mx: 1 } }),
|
|
103
|
+
/* @__PURE__ */ jsxs(CardContent, { sx: { p: 1 }, children: [
|
|
104
|
+
/* @__PURE__ */ jsxs(Grid, { container: true, spacing: 0.5, sx: { mb: 1 }, children: [
|
|
105
|
+
options.map((opt, id) => (
|
|
94
106
|
// eslint-disable-next-line react/no-array-index-key
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
107
|
+
/* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
|
|
108
|
+
Chip,
|
|
97
109
|
{
|
|
98
110
|
size: "small",
|
|
99
|
-
variant:
|
|
100
|
-
icon:
|
|
101
|
-
label: /* @__PURE__ */
|
|
102
|
-
|
|
111
|
+
variant: opt === filter ? "filled" : "outlined",
|
|
112
|
+
icon: ICON_MAP[opt] && /* @__PURE__ */ jsx(Icon, { icon: ICON_MAP[opt] }),
|
|
113
|
+
label: /* @__PURE__ */ jsxs(Typography, { variant: "caption", textTransform: "capitalize", children: [
|
|
114
|
+
opt,
|
|
103
115
|
":",
|
|
104
116
|
" ",
|
|
105
|
-
|
|
117
|
+
opt === "all" ? annotations.length : annotations.filter((annotation) => annotation.type === opt).length
|
|
106
118
|
] }),
|
|
107
|
-
onClick: () =>
|
|
119
|
+
onClick: () => setFilter(opt)
|
|
108
120
|
}
|
|
109
|
-
) },
|
|
121
|
+
) }, id)
|
|
110
122
|
)),
|
|
111
|
-
(
|
|
112
|
-
|
|
123
|
+
(errors == null ? void 0 : errors.length) > 0 && /* @__PURE__ */ jsx(Grid, { item: true, children: /* @__PURE__ */ jsx(
|
|
124
|
+
Tooltip,
|
|
113
125
|
{
|
|
114
|
-
title: /* @__PURE__ */
|
|
115
|
-
/* @__PURE__ */
|
|
126
|
+
title: /* @__PURE__ */ jsx("div", { onClick: (e) => e.stopPropagation(), children: errors.map((err) => /* @__PURE__ */ jsxs("div", { children: [
|
|
127
|
+
/* @__PURE__ */ jsx("span", { style: { textTransform: "capitalize" }, children: err.source.replace(/-/g, " ") }),
|
|
116
128
|
":",
|
|
117
129
|
" ",
|
|
118
|
-
|
|
119
|
-
] },
|
|
120
|
-
children: /* @__PURE__ */
|
|
121
|
-
|
|
130
|
+
err.message
|
|
131
|
+
] }, err.source)) }),
|
|
132
|
+
children: /* @__PURE__ */ jsx(
|
|
133
|
+
Chip,
|
|
122
134
|
{
|
|
123
135
|
size: "small",
|
|
124
136
|
variant: "outlined",
|
|
125
|
-
icon: /* @__PURE__ */
|
|
126
|
-
|
|
137
|
+
icon: /* @__PURE__ */ jsx(
|
|
138
|
+
Icon,
|
|
127
139
|
{
|
|
128
140
|
icon: "material-symbols:timer-outline",
|
|
129
|
-
color:
|
|
141
|
+
color: theme.palette.error.main,
|
|
130
142
|
style: { filter: "drop-shadow(0px 0px 1px rgb(0 0 0 / 0.4))" }
|
|
131
143
|
}
|
|
132
144
|
),
|
|
133
|
-
label: /* @__PURE__ */
|
|
134
|
-
|
|
145
|
+
label: /* @__PURE__ */ jsxs(Typography, { variant: "caption", textTransform: "capitalize", children: [
|
|
146
|
+
t("annotation.failed"),
|
|
135
147
|
": ",
|
|
136
|
-
|
|
148
|
+
errors.length
|
|
137
149
|
] }),
|
|
138
|
-
onClick:
|
|
150
|
+
onClick: forceEnrich
|
|
139
151
|
}
|
|
140
152
|
)
|
|
141
153
|
}
|
|
142
154
|
) })
|
|
143
155
|
] }),
|
|
144
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ jsx(Grid, { container: true, spacing: 1, alignItems: "stretch", children: annotations.map((annotation, id) => (
|
|
145
157
|
// eslint-disable-next-line react/no-array-index-key
|
|
146
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 6, minWidth: "300px", children: /* @__PURE__ */ jsx(Box, { sx: { border: `thin solid ${theme.palette.divider}`, p: 1, height: "100%" }, children: /* @__PURE__ */ jsx(AnnotationEntry, { annotation }) }) }, id)
|
|
147
159
|
)) })
|
|
148
160
|
] })
|
|
149
161
|
]
|
|
150
162
|
}
|
|
151
163
|
);
|
|
152
|
-
}
|
|
164
|
+
};
|
|
165
|
+
const EnrichedCard_default = memo(EnrichedCard);
|
|
153
166
|
export {
|
|
154
|
-
|
|
167
|
+
EnrichedCard_default as default
|
|
155
168
|
};
|
|
@@ -1,145 +1,170 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { Chip
|
|
3
|
-
import
|
|
4
|
-
import { ClueComponentContext
|
|
5
|
-
import { ClueGroupContext
|
|
6
|
-
import { C as
|
|
7
|
-
import { b as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { u as
|
|
16
|
-
const
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Chip, Tooltip, Box, Stack, CircularProgress } from "@mui/material";
|
|
3
|
+
import Iconified from "./display/icons/Iconified.js";
|
|
4
|
+
import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
|
|
5
|
+
import { ClueGroupContext } from "../hooks/ClueGroupContext.js";
|
|
6
|
+
import { C as CluePopupContext } from "../AnnotationPreview-CLMVD6Ec.js";
|
|
7
|
+
import { b as useClueEnrichSelector } from "../ActionForm-C0aE9HUv.js";
|
|
8
|
+
import useAnnotations from "../hooks/useAnnotations.js";
|
|
9
|
+
import ActionIcon from "../icons/Action.js";
|
|
10
|
+
import AssessmentIcon from "../icons/Assessment.js";
|
|
11
|
+
import ContextIcon from "../icons/Context.js";
|
|
12
|
+
import OpinionIcon from "../icons/Opinion.js";
|
|
13
|
+
import FrequencyText from "../text/Frequency.js";
|
|
14
|
+
import React__default, { useRef, useMemo, useCallback, useEffect, memo } from "react";
|
|
15
|
+
import { u as useContextSelector } from "../index-AMfoEg_6.js";
|
|
16
|
+
const EnrichedChip = React__default.memo(
|
|
17
17
|
({
|
|
18
|
-
type:
|
|
19
|
-
value
|
|
20
|
-
classification:
|
|
21
|
-
contextIcon
|
|
22
|
-
counters
|
|
23
|
-
hideDetails
|
|
24
|
-
hideLoading
|
|
25
|
-
forceDetails
|
|
26
|
-
setForceDetails
|
|
27
|
-
useDetailsIcon
|
|
28
|
-
skipEnrichment
|
|
29
|
-
slotProps
|
|
30
|
-
...
|
|
18
|
+
type: _type,
|
|
19
|
+
value,
|
|
20
|
+
classification: _classification,
|
|
21
|
+
contextIcon = false,
|
|
22
|
+
counters = false,
|
|
23
|
+
hideDetails = false,
|
|
24
|
+
hideLoading = false,
|
|
25
|
+
forceDetails = false,
|
|
26
|
+
setForceDetails = null,
|
|
27
|
+
useDetailsIcon = false,
|
|
28
|
+
skipEnrichment = false,
|
|
29
|
+
slotProps = {},
|
|
30
|
+
...otherProps
|
|
31
31
|
}) => {
|
|
32
|
-
const { t
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
33
|
+
const anchorRef = useRef();
|
|
34
|
+
const groupType = useContextSelector(ClueGroupContext, (ctx) => ctx == null ? void 0 : ctx.type);
|
|
35
|
+
const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
|
|
36
|
+
const type = useMemo(() => _type ?? groupType, [_type, groupType]);
|
|
37
|
+
const classification = useMemo(
|
|
38
|
+
() => _classification ?? defaultClassification,
|
|
39
|
+
[_classification, defaultClassification]
|
|
35
40
|
);
|
|
36
|
-
if (!
|
|
41
|
+
if (!type) {
|
|
37
42
|
throw new Error("Type was not provided as a prop, and component is not used in a group context.");
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}
|
|
44
|
+
const [annotations, loading] = useAnnotations(type, value, classification, { skipEnrichment });
|
|
45
|
+
const showInfo = useContextSelector(CluePopupContext, (ctx) => ctx.showInfo);
|
|
46
|
+
const closeInfo = useContextSelector(CluePopupContext, (ctx) => ctx.closeInfo);
|
|
47
|
+
const buildOptions = useCallback(() => {
|
|
48
|
+
const options = {};
|
|
49
|
+
if (setForceDetails) {
|
|
50
|
+
options.onClose = () => setForceDetails(false);
|
|
51
|
+
}
|
|
52
|
+
if (slotProps == null ? void 0 : slotProps.popover) {
|
|
53
|
+
options.popoverProps = slotProps.popover;
|
|
54
|
+
}
|
|
55
|
+
return options;
|
|
56
|
+
}, [setForceDetails, slotProps.popover]);
|
|
57
|
+
const clicker = useMemo(
|
|
58
|
+
() => !hideDetails || useDetailsIcon ? (e) => {
|
|
59
|
+
var _a;
|
|
60
|
+
showInfo("details", anchorRef.current, { type, value, classification }, buildOptions());
|
|
61
|
+
(_a = otherProps.onClick) == null ? void 0 : _a.call(otherProps, e);
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
} : otherProps.onClick,
|
|
46
65
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
-
[
|
|
66
|
+
[hideDetails, useDetailsIcon, otherProps, type, value, classification]
|
|
48
67
|
);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
type
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (forceDetails) {
|
|
70
|
+
showInfo("details", anchorRef.current, { type, value, classification }, buildOptions());
|
|
71
|
+
} else {
|
|
72
|
+
closeInfo("details", {
|
|
73
|
+
type,
|
|
74
|
+
value,
|
|
75
|
+
classification
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}, [classification, forceDetails, type, value]);
|
|
79
|
+
return /* @__PURE__ */ jsx(
|
|
80
|
+
Chip,
|
|
57
81
|
{
|
|
58
|
-
...
|
|
59
|
-
ref:
|
|
60
|
-
variant:
|
|
82
|
+
...otherProps,
|
|
83
|
+
ref: anchorRef,
|
|
84
|
+
variant: otherProps.variant || "outlined",
|
|
61
85
|
sx: {
|
|
62
|
-
height:
|
|
86
|
+
height: otherProps.size !== "small" ? "40px" : "unset",
|
|
63
87
|
"& .MuiChip-label": { overflow: "visible" },
|
|
64
|
-
...
|
|
88
|
+
...otherProps.sx ?? {}
|
|
65
89
|
},
|
|
66
|
-
label: /* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
90
|
+
label: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
AssessmentIcon,
|
|
69
93
|
{
|
|
70
|
-
ubiquitous:
|
|
71
|
-
value: { type
|
|
72
|
-
annotations
|
|
73
|
-
counters
|
|
74
|
-
disableTooltip:
|
|
94
|
+
ubiquitous: true,
|
|
95
|
+
value: { type, value, classification },
|
|
96
|
+
annotations,
|
|
97
|
+
counters,
|
|
98
|
+
disableTooltip: forceDetails,
|
|
75
99
|
style: { flexShrink: 0 }
|
|
76
100
|
}
|
|
77
101
|
),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
OpinionIcon,
|
|
80
104
|
{
|
|
81
|
-
ubiquitous:
|
|
82
|
-
value: { type
|
|
83
|
-
annotations
|
|
84
|
-
counters
|
|
85
|
-
disableTooltip:
|
|
105
|
+
ubiquitous: true,
|
|
106
|
+
value: { type, value, classification },
|
|
107
|
+
annotations,
|
|
108
|
+
counters,
|
|
109
|
+
disableTooltip: forceDetails,
|
|
86
110
|
style: { flexShrink: 0 }
|
|
87
111
|
}
|
|
88
112
|
),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
ContextIcon,
|
|
91
115
|
{
|
|
92
|
-
ubiquitous:
|
|
93
|
-
value: { type
|
|
94
|
-
annotations
|
|
95
|
-
counters
|
|
96
|
-
showExtraIcon:
|
|
97
|
-
disableTooltip:
|
|
116
|
+
ubiquitous: true,
|
|
117
|
+
value: { type, value, classification },
|
|
118
|
+
annotations,
|
|
119
|
+
counters,
|
|
120
|
+
showExtraIcon: contextIcon,
|
|
121
|
+
disableTooltip: forceDetails,
|
|
98
122
|
style: { flexShrink: 0 }
|
|
99
123
|
}
|
|
100
124
|
),
|
|
101
|
-
|
|
102
|
-
/* @__PURE__ */
|
|
103
|
-
|
|
125
|
+
otherProps.label ?? /* @__PURE__ */ jsx(FrequencyText, { fontSize: "inherit", annotations, value }),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
AssessmentIcon,
|
|
104
128
|
{
|
|
105
|
-
value: { type
|
|
106
|
-
annotations
|
|
107
|
-
counters
|
|
108
|
-
disableTooltip:
|
|
129
|
+
value: { type, value, classification },
|
|
130
|
+
annotations,
|
|
131
|
+
counters,
|
|
132
|
+
disableTooltip: forceDetails,
|
|
109
133
|
style: { flexShrink: 0 }
|
|
110
134
|
}
|
|
111
135
|
),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
|
|
136
|
+
/* @__PURE__ */ jsx(
|
|
137
|
+
OpinionIcon,
|
|
114
138
|
{
|
|
115
|
-
value: { type
|
|
116
|
-
annotations
|
|
117
|
-
counters
|
|
118
|
-
disableTooltip:
|
|
139
|
+
value: { type, value, classification },
|
|
140
|
+
annotations,
|
|
141
|
+
counters,
|
|
142
|
+
disableTooltip: forceDetails,
|
|
119
143
|
style: { flexShrink: 0 }
|
|
120
144
|
}
|
|
121
145
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
ContextIcon,
|
|
124
148
|
{
|
|
125
|
-
value: { type
|
|
126
|
-
annotations
|
|
127
|
-
counters
|
|
128
|
-
showExtraIcon:
|
|
129
|
-
disableTooltip:
|
|
149
|
+
value: { type, value, classification },
|
|
150
|
+
annotations,
|
|
151
|
+
counters,
|
|
152
|
+
showExtraIcon: contextIcon,
|
|
153
|
+
disableTooltip: forceDetails,
|
|
130
154
|
style: { flexShrink: 0 }
|
|
131
155
|
}
|
|
132
156
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
157
|
+
/* @__PURE__ */ jsx(ActionIcon, { counters, value: { type, value, classification }, disableTooltip: forceDetails }),
|
|
158
|
+
loading && !hideLoading && /* @__PURE__ */ jsx(CircularProgress, { color: "primary", size: 16 })
|
|
135
159
|
] }),
|
|
136
|
-
onClick:
|
|
137
|
-
onDelete: !
|
|
138
|
-
deleteIcon:
|
|
160
|
+
onClick: !useDetailsIcon ? clicker : void 0,
|
|
161
|
+
onDelete: !loading && useDetailsIcon ? clicker : void 0,
|
|
162
|
+
deleteIcon: useDetailsIcon ? /* @__PURE__ */ jsx(Tooltip, { title: t("details.open"), children: /* @__PURE__ */ jsx(Box, { component: "span", sx: { pr: 1 }, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-info" }) }) }) : null
|
|
139
163
|
}
|
|
140
164
|
);
|
|
141
165
|
}
|
|
142
|
-
)
|
|
166
|
+
);
|
|
167
|
+
const EnrichedChip_default = memo(EnrichedChip);
|
|
143
168
|
export {
|
|
144
|
-
|
|
169
|
+
EnrichedChip_default as default
|
|
145
170
|
};
|