@cccsaurora/clue-ui 1.0.2 → 1.1.0-dev.10
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-D4ryHO0M.js +436 -0
- package/AnnotationDetails-YAPoqw3R.js +175 -0
- package/AnnotationPreview-DiQDjt9s.js +188 -0
- package/ClueEnrichContext-DIn6g8tw.js +522 -0
- package/FlexOne-BSYAhhtG.js +9 -0
- package/_Map-kgDsDYxq.js +64 -0
- package/_MapCache-DabaaWfq.js +161 -0
- package/_Uint8Array-BlVVH1tp.js +129 -0
- package/_baseAssignValue-CNbcU6Nb.js +25 -0
- package/_baseClone-D3a8Pa4T.js +284 -0
- package/_baseExtremum-B1o1zHjR.js +33 -0
- package/_baseFlatten-D4huXoEI.js +92 -0
- package/_baseGet-BSK_nnoz.js +109 -0
- package/_baseIsEqual-B5xLoweL.js +238 -0
- package/_baseIteratee-p6Nj07-n.js +126 -0
- package/_baseSlice-GAv_YFTT.js +20 -0
- package/_baseSum-D0WC1dN0.js +13 -0
- package/_baseUniq-CpupKWcL.js +89 -0
- package/_commonjsHelpers-CUmg6egw.js +6 -0
- package/_createAggregator-BpVy5xMi.js +63 -0
- package/_getPrototype-D1LAdQKO.js +5 -0
- package/_getTag-D3ToyefI.js +126 -0
- package/cloneDeep-CjP5k9zW.js +8 -0
- package/components/AnnotationBody.js +49 -34
- package/components/AnnotationDetailPopover.js +36 -30
- package/components/AnnotationDetails.js +6 -6
- package/components/AnnotationEntry.js +50 -47
- package/components/AnnotationPreview.js +5 -5
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +104 -92
- package/components/EnrichedChip.js +134 -109
- package/components/EnrichedTypography.js +136 -110
- 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 +64 -50
- package/components/actions/ResultModal.js +37 -34
- package/components/actions/form/schemaAdapter.js +39 -20
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +92 -76
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +258 -200
- 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 -305
- package/components/display/icons/Iconified.js +27 -12
- package/components/display/json/index.js +4 -4
- package/components/display/markdown/DynamicTabs.js +22 -17
- package/components/display/markdown/index.js +8527 -5670
- package/components/display/markdown/markdownPlugins/tabs.js +1 -1
- package/components/enrichment/EnrichPopover.js +55 -47
- package/components/fetchers/Fetcher.js +123 -95
- package/components/fetchers/PreviewModal.js +20 -17
- package/components/fetchers/StatusChip.js +22 -18
- 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 +37 -28
- package/countBy-C69WslUA.js +14 -0
- package/data/event.js +6 -4
- package/database/index.js +2 -2
- package/debounce-bV0h5FC5.js +92 -0
- package/get-D3C3lEU3.js +8 -0
- package/groupBy-DC2oOuBN.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 +74 -46
- package/hooks/ClueGroupContext.js +17 -14
- package/hooks/CluePopupContext.js +5 -5
- package/hooks/ClueProvider.js +12 -10
- package/hooks/selectors.js +22 -11
- package/hooks/useAnnotations.js +45 -29
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.js +5 -5
- package/hooks/useClueTypeConfig.js +3 -3
- package/hooks/useComparator.js +722 -435
- package/hooks/useErrors.js +22 -18
- package/hooks/useMyHighlights.js +66 -36
- package/hooks/useMyLocalStorage.js +63 -43
- package/iconify-CXMreGTg.js +1782 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +84 -68
- package/icons/Context.js +75 -61
- package/icons/Opinion.js +77 -65
- package/icons/iconMap.js +2 -2
- package/identity-CPGTqrE4.js +6 -0
- package/index-BDVjGvMI.js +696 -0
- package/index-BHPT3qoB.js +1172 -0
- package/index-BMxyILVD.js +465 -0
- package/index-BbPn6-Mw.js +15750 -0
- package/index-Dz1kF2MU.js +17654 -0
- package/isEmpty-BQkZubqU.js +29 -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 +58 -58
- package/package.json +1 -1
- package/sortBy-B-UKp4GT.js +100 -0
- package/sumBy-MYkDPHZL.js +8 -0
- package/tabs-xGuUGsJd.js +254 -0
- package/text/Frequency.js +42 -23
- package/toFinite-Bc55msYj.js +16 -0
- package/toNumber-DPxy1FBy.js +39 -0
- package/useClueTypeConfig-CH-nGq6a.js +3184 -0
- package/utils/chain.js +91 -64
- 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 -29
- package/utils/utils.js +9 -9
- package/utils/window.js +21 -10
- package/utils-Dr4wbKBZ.js +4182 -0
- package/ActionForm-BtTv0s4P.js +0 -340
- package/AnnotationDetails-D5tBIeEw.js +0 -160
- package/AnnotationPreview-CZr_CcZC.js +0 -140
- package/ClueEnrichContext-DH9lqjwH.js +0 -401
- package/FlexOne-BXWFOd1T.js +0 -6
- package/_Map-DXNg_Z-q.js +0 -54
- package/_MapCache-Cu25RRDU.js +0 -129
- package/_Uint8Array-DlJCtTvG.js +0 -102
- package/_baseAssignValue-CUmzp727.js +0 -20
- package/_baseClone-BlMmRXeX.js +0 -208
- package/_baseExtremum-P_0akmCi.js +0 -27
- package/_baseFlatten-CN7vDNEQ.js +0 -72
- package/_baseGet-Dgf6_xCm.js +0 -80
- package/_baseIsEqual-Cpjtfb3Q.js +0 -173
- package/_baseIteratee-CP1bocOX.js +0 -95
- package/_baseSlice-M5RKzt1A.js +0 -10
- package/_baseSum-wEbgNeUs.js +0 -10
- package/_baseUniq-tMFmk80M.js +0 -61
- package/_commonjsHelpers-C6fGbg64.js +0 -6
- package/_createAggregator-B4Cav8ZM.js +0 -53
- package/_getPrototype-CHAFQYL_.js +0 -5
- package/_getTag-BV_UoLYG.js +0 -90
- package/cloneDeep-BPVpFBzJ.js +0 -8
- package/countBy-DOutsa_w.js +0 -8
- package/debounce-DryYcbJ4.js +0 -56
- package/get-Bow1vKwx.js +0 -8
- package/groupBy-BheQYl6f.js +0 -8
- package/iconify-BBckr5AQ.js +0 -1263
- package/identity-ByMq8VxU.js +0 -6
- package/index-BUcHmehh.js +0 -975
- package/index-Bo-v5IAc.js +0 -12754
- package/index-CnaCBNrd.js +0 -358
- package/index-E7g8cRyW.js +0 -568
- package/index-p5_wX7q1.js +0 -11729
- package/isEmpty-g47Qir2A.js +0 -21
- 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/sortBy-ITdmD17L.js +0 -79
- package/sumBy-DxJUU2E8.js +0 -8
- package/tabs-CgADNA57.js +0 -195
- package/toFinite-BMy6GObD.js +0 -14
- package/toNumber-YVhnnJv4.js +0 -31
- package/useClueTypeConfig-CneP98N_.js +0 -2260
- package/utils-CD0rFIFU.js +0 -2704
|
@@ -1,151 +1,176 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { Chip
|
|
3
|
-
import
|
|
4
|
-
import { ClueComponentContext
|
|
5
|
-
import { ClueGroupContext
|
|
6
|
-
import { C as
|
|
7
|
-
import { useClueEnrichSelector
|
|
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-DiQDjt9s.js";
|
|
7
|
+
import { useClueEnrichSelector } from "../hooks/selectors.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-BDVjGvMI.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
|
+
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
|
+
() => !loading ? !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 : (
|
|
43
65
|
// We need to give a dummy callback when loading so the popover doesn't get confused
|
|
44
|
-
(
|
|
45
|
-
var
|
|
46
|
-
(
|
|
66
|
+
(e) => {
|
|
67
|
+
var _a;
|
|
68
|
+
(_a = otherProps.onClick) == null ? void 0 : _a.call(otherProps, e);
|
|
47
69
|
}
|
|
48
|
-
)
|
|
49
|
-
var r;
|
|
50
|
-
g("details", C.current, { type: n, value: o, classification: e }, h()), (r = t.onClick) == null || r.call(t, i), i.stopPropagation(), i.preventDefault();
|
|
51
|
-
} : t.onClick,
|
|
70
|
+
),
|
|
52
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
-
[
|
|
72
|
+
[loading, hideDetails, useDetailsIcon, otherProps, type, value, classification]
|
|
54
73
|
);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (forceDetails) {
|
|
76
|
+
showInfo("details", anchorRef.current, { type, value, classification }, buildOptions());
|
|
77
|
+
} else {
|
|
78
|
+
closeInfo("details", {
|
|
79
|
+
type,
|
|
80
|
+
value,
|
|
81
|
+
classification
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}, [classification, forceDetails, type, value]);
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
Chip,
|
|
63
87
|
{
|
|
64
|
-
...
|
|
65
|
-
ref:
|
|
66
|
-
variant:
|
|
88
|
+
...otherProps,
|
|
89
|
+
ref: anchorRef,
|
|
90
|
+
variant: otherProps.variant || "outlined",
|
|
67
91
|
sx: {
|
|
68
|
-
height:
|
|
92
|
+
height: otherProps.size !== "small" ? "40px" : "unset",
|
|
69
93
|
"& .MuiChip-label": { overflow: "visible" },
|
|
70
|
-
...
|
|
94
|
+
...otherProps.sx ?? {}
|
|
71
95
|
},
|
|
72
|
-
label: /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
96
|
+
label: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
AssessmentIcon,
|
|
75
99
|
{
|
|
76
|
-
ubiquitous:
|
|
77
|
-
value: { type
|
|
78
|
-
annotations
|
|
79
|
-
counters
|
|
80
|
-
disableTooltip:
|
|
100
|
+
ubiquitous: true,
|
|
101
|
+
value: { type, value, classification },
|
|
102
|
+
annotations,
|
|
103
|
+
counters,
|
|
104
|
+
disableTooltip: forceDetails,
|
|
81
105
|
style: { flexShrink: 0 }
|
|
82
106
|
}
|
|
83
107
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
109
|
+
OpinionIcon,
|
|
86
110
|
{
|
|
87
|
-
ubiquitous:
|
|
88
|
-
value: { type
|
|
89
|
-
annotations
|
|
90
|
-
counters
|
|
91
|
-
disableTooltip:
|
|
111
|
+
ubiquitous: true,
|
|
112
|
+
value: { type, value, classification },
|
|
113
|
+
annotations,
|
|
114
|
+
counters,
|
|
115
|
+
disableTooltip: forceDetails,
|
|
92
116
|
style: { flexShrink: 0 }
|
|
93
117
|
}
|
|
94
118
|
),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
ContextIcon,
|
|
97
121
|
{
|
|
98
|
-
ubiquitous:
|
|
99
|
-
value: { type
|
|
100
|
-
annotations
|
|
101
|
-
counters
|
|
102
|
-
showExtraIcon:
|
|
103
|
-
disableTooltip:
|
|
122
|
+
ubiquitous: true,
|
|
123
|
+
value: { type, value, classification },
|
|
124
|
+
annotations,
|
|
125
|
+
counters,
|
|
126
|
+
showExtraIcon: contextIcon,
|
|
127
|
+
disableTooltip: forceDetails,
|
|
104
128
|
style: { flexShrink: 0 }
|
|
105
129
|
}
|
|
106
130
|
),
|
|
107
|
-
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
131
|
+
otherProps.label ?? /* @__PURE__ */ jsx(FrequencyText, { fontSize: "inherit", annotations, value }),
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
AssessmentIcon,
|
|
110
134
|
{
|
|
111
|
-
value: { type
|
|
112
|
-
annotations
|
|
113
|
-
counters
|
|
114
|
-
disableTooltip:
|
|
135
|
+
value: { type, value, classification },
|
|
136
|
+
annotations,
|
|
137
|
+
counters,
|
|
138
|
+
disableTooltip: forceDetails,
|
|
115
139
|
style: { flexShrink: 0 }
|
|
116
140
|
}
|
|
117
141
|
),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
OpinionIcon,
|
|
120
144
|
{
|
|
121
|
-
value: { type
|
|
122
|
-
annotations
|
|
123
|
-
counters
|
|
124
|
-
disableTooltip:
|
|
145
|
+
value: { type, value, classification },
|
|
146
|
+
annotations,
|
|
147
|
+
counters,
|
|
148
|
+
disableTooltip: forceDetails,
|
|
125
149
|
style: { flexShrink: 0 }
|
|
126
150
|
}
|
|
127
151
|
),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
ContextIcon,
|
|
130
154
|
{
|
|
131
|
-
value: { type
|
|
132
|
-
annotations
|
|
133
|
-
counters
|
|
134
|
-
showExtraIcon:
|
|
135
|
-
disableTooltip:
|
|
155
|
+
value: { type, value, classification },
|
|
156
|
+
annotations,
|
|
157
|
+
counters,
|
|
158
|
+
showExtraIcon: contextIcon,
|
|
159
|
+
disableTooltip: forceDetails,
|
|
136
160
|
style: { flexShrink: 0 }
|
|
137
161
|
}
|
|
138
162
|
),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
163
|
+
/* @__PURE__ */ jsx(ActionIcon, { counters, value: { type, value, classification }, disableTooltip: forceDetails }),
|
|
164
|
+
loading && !hideLoading && /* @__PURE__ */ jsx(CircularProgress, { color: "primary", size: 16 })
|
|
141
165
|
] }),
|
|
142
|
-
onClick:
|
|
143
|
-
onDelete: !
|
|
144
|
-
deleteIcon:
|
|
166
|
+
onClick: !useDetailsIcon ? clicker : void 0,
|
|
167
|
+
onDelete: !loading && useDetailsIcon ? clicker : void 0,
|
|
168
|
+
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
|
|
145
169
|
}
|
|
146
170
|
);
|
|
147
171
|
}
|
|
148
|
-
)
|
|
172
|
+
);
|
|
173
|
+
const EnrichedChip$1 = memo(EnrichedChip);
|
|
149
174
|
export {
|
|
150
|
-
|
|
175
|
+
EnrichedChip$1 as default
|
|
151
176
|
};
|
|
@@ -1,152 +1,178 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import { useTheme
|
|
3
|
-
import
|
|
4
|
-
import { ClueComponentContext
|
|
5
|
-
import { ClueGroupContext
|
|
6
|
-
import { C as
|
|
7
|
-
import { useClueEnrichSelector
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { memo
|
|
15
|
-
import { u as
|
|
16
|
-
const
|
|
17
|
-
type:
|
|
18
|
-
value
|
|
19
|
-
classification:
|
|
20
|
-
contextIcon
|
|
21
|
-
counters
|
|
22
|
-
hideDetails
|
|
23
|
-
hideLoading
|
|
24
|
-
forceDetails
|
|
25
|
-
setForceDetails
|
|
26
|
-
useDetailsIcon
|
|
27
|
-
skipEnrichment
|
|
28
|
-
slotProps
|
|
29
|
-
children
|
|
30
|
-
...
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme, Stack, CircularProgress, Tooltip, IconButton } 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-DiQDjt9s.js";
|
|
7
|
+
import { useClueEnrichSelector } from "../hooks/selectors.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 { memo, useRef, useMemo, useCallback, useEffect } from "react";
|
|
15
|
+
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
|
16
|
+
const EnrichedTypography = ({
|
|
17
|
+
type: _type,
|
|
18
|
+
value,
|
|
19
|
+
classification: _classification,
|
|
20
|
+
contextIcon = false,
|
|
21
|
+
counters = false,
|
|
22
|
+
hideDetails = false,
|
|
23
|
+
hideLoading = false,
|
|
24
|
+
forceDetails = false,
|
|
25
|
+
setForceDetails = null,
|
|
26
|
+
useDetailsIcon = false,
|
|
27
|
+
skipEnrichment = false,
|
|
28
|
+
slotProps = {},
|
|
29
|
+
children,
|
|
30
|
+
...otherProps
|
|
31
31
|
}) => {
|
|
32
|
-
var
|
|
33
|
-
const { t
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
const anchorRef = useRef();
|
|
36
|
+
const groupType = useContextSelector(ClueGroupContext, (ctx) => ctx == null ? void 0 : ctx.type);
|
|
37
|
+
const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
|
|
38
|
+
const type = useMemo(() => _type ?? groupType, [_type, groupType]);
|
|
39
|
+
const classification = useMemo(
|
|
40
|
+
() => _classification ?? defaultClassification,
|
|
41
|
+
[_classification, defaultClassification]
|
|
36
42
|
);
|
|
37
|
-
if (!
|
|
43
|
+
if (!type) {
|
|
38
44
|
throw new Error("Type was not provided as a prop, and component is not used in a group context.");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
}
|
|
46
|
+
const [annotations, loading] = useAnnotations(type, value, classification, { skipEnrichment });
|
|
47
|
+
const showInfo = useContextSelector(CluePopupContext, (state) => state.showInfo);
|
|
48
|
+
const closeInfo = useContextSelector(CluePopupContext, (state) => state.closeInfo);
|
|
49
|
+
const buildOptions = useCallback(() => {
|
|
50
|
+
const options = {};
|
|
51
|
+
if (setForceDetails) {
|
|
52
|
+
options.onClose = () => setForceDetails(false);
|
|
53
|
+
}
|
|
54
|
+
if (slotProps == null ? void 0 : slotProps.popover) {
|
|
55
|
+
options.popoverProps = slotProps.popover;
|
|
56
|
+
}
|
|
57
|
+
return options;
|
|
58
|
+
}, [setForceDetails, slotProps.popover]);
|
|
59
|
+
const clicker = useMemo(
|
|
60
|
+
() => !loading ? !hideDetails || useDetailsIcon ? (e) => {
|
|
61
|
+
var _a2;
|
|
62
|
+
showInfo("details", anchorRef.current, { type, value, classification }, buildOptions());
|
|
63
|
+
(_a2 = otherProps.onClick) == null ? void 0 : _a2.call(otherProps, e);
|
|
64
|
+
e.stopPropagation();
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
} : otherProps.onClick : (
|
|
44
67
|
// We need to give a dummy callback when loading so the popover doesn't get confused
|
|
45
|
-
(
|
|
46
|
-
var
|
|
47
|
-
(
|
|
68
|
+
(e) => {
|
|
69
|
+
var _a2;
|
|
70
|
+
(_a2 = otherProps.onClick) == null ? void 0 : _a2.call(otherProps, e);
|
|
48
71
|
}
|
|
49
|
-
)
|
|
50
|
-
var u;
|
|
51
|
-
E("details", T.current, { type: o, value: t, classification: e }, h()), (u = m.onClick) == null || u.call(m, i), i.stopPropagation(), i.preventDefault();
|
|
52
|
-
} : m.onClick,
|
|
72
|
+
),
|
|
53
73
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
-
[
|
|
74
|
+
[loading, hideDetails, useDetailsIcon, otherProps, type, value, classification]
|
|
55
75
|
);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
type
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (forceDetails) {
|
|
78
|
+
showInfo("details", anchorRef.current, { type, value, classification }, buildOptions());
|
|
79
|
+
} else {
|
|
80
|
+
closeInfo("details", {
|
|
81
|
+
type,
|
|
82
|
+
value,
|
|
83
|
+
classification
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, [classification, forceDetails, type, value]);
|
|
87
|
+
return /* @__PURE__ */ jsxs(
|
|
88
|
+
Stack,
|
|
64
89
|
{
|
|
65
|
-
ref:
|
|
90
|
+
ref: anchorRef,
|
|
66
91
|
direction: "row",
|
|
67
92
|
spacing: 1,
|
|
68
93
|
alignItems: "center",
|
|
69
|
-
...
|
|
94
|
+
...slotProps == null ? void 0 : slotProps.stack,
|
|
70
95
|
sx: [
|
|
71
96
|
{
|
|
72
|
-
cursor: !
|
|
97
|
+
cursor: !loading && !hideDetails ? "pointer" : "inherit",
|
|
73
98
|
borderBottom: "1px solid transparent",
|
|
74
|
-
transition:
|
|
99
|
+
transition: theme.transitions.create(["border-bottom-color"]),
|
|
75
100
|
"&:hover": {
|
|
76
|
-
borderBottomColor: !
|
|
101
|
+
borderBottomColor: !loading && (!hideDetails ? theme.palette.primary.light : null)
|
|
77
102
|
}
|
|
78
103
|
},
|
|
79
|
-
...Array.isArray((
|
|
104
|
+
...Array.isArray((_a = slotProps == null ? void 0 : slotProps.stack) == null ? void 0 : _a.sx) ? (_b = slotProps == null ? void 0 : slotProps.stack) == null ? void 0 : _b.sx : [(_c = slotProps == null ? void 0 : slotProps.stack) == null ? void 0 : _c.sx]
|
|
80
105
|
],
|
|
81
|
-
onClick:
|
|
106
|
+
onClick: !useDetailsIcon ? clicker : void 0,
|
|
82
107
|
children: [
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
109
|
+
AssessmentIcon,
|
|
85
110
|
{
|
|
86
|
-
ubiquitous:
|
|
87
|
-
value: { type
|
|
88
|
-
annotations
|
|
89
|
-
counters
|
|
90
|
-
disableTooltip:
|
|
111
|
+
ubiquitous: true,
|
|
112
|
+
value: { type, value, classification },
|
|
113
|
+
annotations,
|
|
114
|
+
counters,
|
|
115
|
+
disableTooltip: forceDetails
|
|
91
116
|
}
|
|
92
117
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
OpinionIcon,
|
|
95
120
|
{
|
|
96
|
-
ubiquitous:
|
|
97
|
-
value: { type
|
|
98
|
-
annotations
|
|
99
|
-
counters
|
|
100
|
-
disableTooltip:
|
|
121
|
+
ubiquitous: true,
|
|
122
|
+
value: { type, value, classification },
|
|
123
|
+
annotations,
|
|
124
|
+
counters,
|
|
125
|
+
disableTooltip: forceDetails
|
|
101
126
|
}
|
|
102
127
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
ContextIcon,
|
|
105
130
|
{
|
|
106
|
-
ubiquitous:
|
|
107
|
-
value: { type
|
|
108
|
-
annotations
|
|
109
|
-
counters
|
|
110
|
-
showExtraIcon:
|
|
111
|
-
disableTooltip:
|
|
131
|
+
ubiquitous: true,
|
|
132
|
+
value: { type, value, classification },
|
|
133
|
+
annotations,
|
|
134
|
+
counters,
|
|
135
|
+
showExtraIcon: contextIcon,
|
|
136
|
+
disableTooltip: forceDetails
|
|
112
137
|
}
|
|
113
138
|
),
|
|
114
|
-
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
139
|
+
children ?? /* @__PURE__ */ jsx(FrequencyText, { id: `enriched-${type}-value`, ...otherProps, annotations, value }),
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
AssessmentIcon,
|
|
117
142
|
{
|
|
118
|
-
value: { type
|
|
119
|
-
annotations
|
|
120
|
-
counters
|
|
121
|
-
disableTooltip:
|
|
143
|
+
value: { type, value, classification },
|
|
144
|
+
annotations,
|
|
145
|
+
counters,
|
|
146
|
+
disableTooltip: forceDetails
|
|
122
147
|
}
|
|
123
148
|
),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
|
|
149
|
+
/* @__PURE__ */ jsx(
|
|
150
|
+
OpinionIcon,
|
|
126
151
|
{
|
|
127
|
-
value: { type
|
|
128
|
-
annotations
|
|
129
|
-
counters
|
|
130
|
-
disableTooltip:
|
|
152
|
+
value: { type, value, classification },
|
|
153
|
+
annotations,
|
|
154
|
+
counters,
|
|
155
|
+
disableTooltip: forceDetails
|
|
131
156
|
}
|
|
132
157
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
ContextIcon,
|
|
135
160
|
{
|
|
136
|
-
value: { type
|
|
137
|
-
annotations
|
|
138
|
-
counters
|
|
139
|
-
showExtraIcon:
|
|
140
|
-
disableTooltip:
|
|
161
|
+
value: { type, value, classification },
|
|
162
|
+
annotations,
|
|
163
|
+
counters,
|
|
164
|
+
showExtraIcon: contextIcon,
|
|
165
|
+
disableTooltip: forceDetails
|
|
141
166
|
}
|
|
142
167
|
),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
145
|
-
!
|
|
168
|
+
/* @__PURE__ */ jsx(ActionIcon, { counters, value: { type, value, classification }, disableTooltip: forceDetails }),
|
|
169
|
+
loading && !hideLoading && /* @__PURE__ */ jsx(CircularProgress, { color: "primary", size: 18 }),
|
|
170
|
+
!loading && useDetailsIcon && /* @__PURE__ */ jsx(Tooltip, { title: t("details.open"), children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: clicker, sx: { color: theme.palette.action.disabled }, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:outline-info" }) }) })
|
|
146
171
|
]
|
|
147
172
|
}
|
|
148
173
|
);
|
|
149
|
-
}
|
|
174
|
+
};
|
|
175
|
+
const EnrichedTypography$1 = memo(EnrichedTypography);
|
|
150
176
|
export {
|
|
151
|
-
|
|
177
|
+
EnrichedTypography$1 as default
|
|
152
178
|
};
|
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { Box
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
class
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Accordion, AccordionSummary, Typography, AccordionDetails } from "@mui/material";
|
|
3
|
+
import Iconified from "./display/icons/Iconified.js";
|
|
4
|
+
import React__default from "react";
|
|
5
|
+
class ErrorBoundary extends React__default.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.state = { hasError: false, error: null };
|
|
8
9
|
}
|
|
9
|
-
static getDerivedStateFromError(
|
|
10
|
-
return { hasError:
|
|
10
|
+
static getDerivedStateFromError(error) {
|
|
11
|
+
return { hasError: true, error };
|
|
11
12
|
}
|
|
12
|
-
componentDidCatch(
|
|
13
|
-
this.setState({ hasError:
|
|
13
|
+
componentDidCatch(error) {
|
|
14
|
+
this.setState({ hasError: true, error });
|
|
14
15
|
}
|
|
15
16
|
render() {
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
if (this.state.hasError) {
|
|
18
|
+
return /* @__PURE__ */ jsx(Box, { pt: 6, textAlign: "center", fontSize: 20, children: /* @__PURE__ */ jsxs(Accordion, { elevation: 0, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
AccordionSummary,
|
|
21
|
+
{
|
|
22
|
+
expandIcon: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-expand-more" }),
|
|
23
|
+
"aria-controls": "panel1-content",
|
|
24
|
+
id: "panel1-header",
|
|
25
|
+
children: /* @__PURE__ */ jsx(Typography, { align: "center", sx: { width: "100%", fontSize: "1.2rem" }, variant: "h5", children: this.state.error.message })
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ jsx(AccordionDetails, { children: /* @__PURE__ */ jsx("code", { children: /* @__PURE__ */ jsx(Typography, { variant: "h6", children: this.state.error.stack }) }) })
|
|
29
|
+
] }) });
|
|
30
|
+
}
|
|
31
|
+
return this.props.children;
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
export {
|
|
31
|
-
|
|
35
|
+
ErrorBoundary as default
|
|
32
36
|
};
|