@cccsaurora/clue-ui 1.0.4 → 1.1.0-dev.100
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-ByeOzpc4.js +555 -0
- package/AnnotationDetails-DknbKDyl.js +175 -0
- package/AnnotationPreview-CQwKs8se.js +188 -0
- package/ClueEnrichContext-6NJfXpUB.js +536 -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-DWwsNxpa.js +8 -0
- package/_createAggregator-BpVy5xMi.js +63 -0
- package/_getPrototype-D1LAdQKO.js +5 -0
- package/_getTag-D3ToyefI.js +126 -0
- package/api/lookup/index.d.ts +1 -1
- package/api/lookup/types.d.ts +2 -2
- package/api/lookup/types_detection.d.ts +2 -2
- 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.d.ts +2 -1
- package/components/ClassificationChip.js +44 -23
- package/components/CountBadge.js +31 -26
- package/components/EnrichedCard.js +110 -92
- package/components/EnrichedChip.js +130 -111
- package/components/EnrichedTypography.d.ts +1 -1
- package/components/EnrichedTypography.js +133 -112
- 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 +12 -41
- package/components/actions/form/schemaAdapter.js +40 -20
- package/components/display/graph/ExpandMoreButton.js +10 -10
- package/components/display/graph/elements/NodeCard.js +114 -76
- package/components/display/graph/elements/NodeTag.js +15 -13
- package/components/display/graph/index.js +267 -210
- 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/index.js +8696 -5668
- 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 +21 -18
- package/components/group/Entry.js +13 -11
- package/components/group/Group.js +13 -10
- package/components/group/GroupControl.js +78 -66
- package/components/stats/QueryStatus.js +44 -31
- 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/en/translation.json +39 -59
- package/fr/translation.json +37 -56
- package/get-D3C3lEU3.js +8 -0
- package/groupBy-DC2oOuBN.js +14 -0
- package/hooks/ClueActionContext.d.ts +26 -0
- package/hooks/ClueActionContext.js +8 -7
- 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/ClueEnrichProps.d.ts +3 -1
- 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.d.ts +4 -5
- package/hooks/selectors.js +21 -11
- package/hooks/useActionResult.d.ts +14 -0
- package/hooks/useActionResult.js +5 -0
- package/hooks/useAnnotations.js +45 -29
- package/hooks/useClue.js +6 -4
- package/hooks/useClueActions.d.ts +1 -1
- package/hooks/useClueActions.js +3 -3
- package/hooks/useClueConfig.d.ts +2 -1
- package/hooks/useClueConfig.js +6 -6
- 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.d.ts +4 -3
- package/hooks/useMyLocalStorage.js +66 -46
- package/iconify-CXMreGTg.js +1782 -0
- package/icons/Action.js +66 -49
- package/icons/Assessment.js +84 -68
- package/icons/Context.js +78 -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-BbPn6-Mw.js +15750 -0
- package/index-Bi21Wb23.js +465 -0
- package/index-C3lkTD69.js +1172 -0
- package/index-CC12Ux-9.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 +62 -62
- package/package.json +3 -3
- package/sortBy-B-UKp4GT.js +100 -0
- package/sumBy-MYkDPHZL.js +8 -0
- package/text/Frequency.js +42 -23
- package/toFinite-Bc55msYj.js +16 -0
- package/toNumber-DPxy1FBy.js +39 -0
- package/types/RunningActionData.d.ts +4 -3
- package/types/action.d.ts +10 -1
- package/useClueTypeConfig-XvGvIw2S.js +3201 -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.d.ts +1 -1
- package/utils/loggerUtil.js +6 -4
- package/utils/sessionStorage.js +41 -29
- package/utils/time.d.ts +3 -0
- package/utils/time.js +536 -0
- package/utils/utils.js +10 -9
- package/utils/window.js +21 -10
- package/utils-7OtvGnmf.js +200 -0
- package/ActionForm-Sw7D-KOE.js +0 -340
- package/AnnotationDetails-BoX61_IF.js +0 -160
- package/AnnotationPreview-dYinoSA9.js +0 -140
- package/ClueEnrichContext-CvCIPOMC.js +0 -412
- 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/components/display/markdown/DynamicTabs.d.ts +0 -8
- package/components/display/markdown/DynamicTabs.js +0 -21
- package/components/display/markdown/markdownPlugins/tabs.d.ts +0 -3
- package/components/display/markdown/markdownPlugins/tabs.js +0 -4
- 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-CnaCBNrd.js +0 -358
- package/index-E7g8cRyW.js +0 -568
- package/index-V7wwd05F.js +0 -975
- package/index-p5_wX7q1.js +0 -11729
- package/index-pQg5VUAZ.js +0 -12734
- 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,170 @@
|
|
|
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-CQwKs8se.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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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,
|
|
52
65
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
-
[
|
|
66
|
+
[hideDetails, useDetailsIcon, otherProps, type, value, classification]
|
|
54
67
|
);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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,
|
|
63
81
|
{
|
|
64
|
-
...
|
|
65
|
-
ref:
|
|
66
|
-
variant:
|
|
82
|
+
...otherProps,
|
|
83
|
+
ref: anchorRef,
|
|
84
|
+
variant: otherProps.variant || "outlined",
|
|
67
85
|
sx: {
|
|
68
|
-
height:
|
|
86
|
+
height: otherProps.size !== "small" ? "40px" : "unset",
|
|
69
87
|
"& .MuiChip-label": { overflow: "visible" },
|
|
70
|
-
...
|
|
88
|
+
...otherProps.sx ?? {}
|
|
71
89
|
},
|
|
72
|
-
label: /* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
90
|
+
label: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
91
|
+
/* @__PURE__ */ jsx(
|
|
92
|
+
AssessmentIcon,
|
|
75
93
|
{
|
|
76
|
-
ubiquitous:
|
|
77
|
-
value: { type
|
|
78
|
-
annotations
|
|
79
|
-
counters
|
|
80
|
-
disableTooltip:
|
|
94
|
+
ubiquitous: true,
|
|
95
|
+
value: { type, value, classification },
|
|
96
|
+
annotations,
|
|
97
|
+
counters,
|
|
98
|
+
disableTooltip: forceDetails,
|
|
81
99
|
style: { flexShrink: 0 }
|
|
82
100
|
}
|
|
83
101
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
OpinionIcon,
|
|
86
104
|
{
|
|
87
|
-
ubiquitous:
|
|
88
|
-
value: { type
|
|
89
|
-
annotations
|
|
90
|
-
counters
|
|
91
|
-
disableTooltip:
|
|
105
|
+
ubiquitous: true,
|
|
106
|
+
value: { type, value, classification },
|
|
107
|
+
annotations,
|
|
108
|
+
counters,
|
|
109
|
+
disableTooltip: forceDetails,
|
|
92
110
|
style: { flexShrink: 0 }
|
|
93
111
|
}
|
|
94
112
|
),
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
ContextIcon,
|
|
97
115
|
{
|
|
98
|
-
ubiquitous:
|
|
99
|
-
value: { type
|
|
100
|
-
annotations
|
|
101
|
-
counters
|
|
102
|
-
showExtraIcon:
|
|
103
|
-
disableTooltip:
|
|
116
|
+
ubiquitous: true,
|
|
117
|
+
value: { type, value, classification },
|
|
118
|
+
annotations,
|
|
119
|
+
counters,
|
|
120
|
+
showExtraIcon: contextIcon,
|
|
121
|
+
disableTooltip: forceDetails,
|
|
104
122
|
style: { flexShrink: 0 }
|
|
105
123
|
}
|
|
106
124
|
),
|
|
107
|
-
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
125
|
+
otherProps.label ?? /* @__PURE__ */ jsx(FrequencyText, { fontSize: "inherit", annotations, value }),
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
AssessmentIcon,
|
|
110
128
|
{
|
|
111
|
-
value: { type
|
|
112
|
-
annotations
|
|
113
|
-
counters
|
|
114
|
-
disableTooltip:
|
|
129
|
+
value: { type, value, classification },
|
|
130
|
+
annotations,
|
|
131
|
+
counters,
|
|
132
|
+
disableTooltip: forceDetails,
|
|
115
133
|
style: { flexShrink: 0 }
|
|
116
134
|
}
|
|
117
135
|
),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
|
|
136
|
+
/* @__PURE__ */ jsx(
|
|
137
|
+
OpinionIcon,
|
|
120
138
|
{
|
|
121
|
-
value: { type
|
|
122
|
-
annotations
|
|
123
|
-
counters
|
|
124
|
-
disableTooltip:
|
|
139
|
+
value: { type, value, classification },
|
|
140
|
+
annotations,
|
|
141
|
+
counters,
|
|
142
|
+
disableTooltip: forceDetails,
|
|
125
143
|
style: { flexShrink: 0 }
|
|
126
144
|
}
|
|
127
145
|
),
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
146
|
+
/* @__PURE__ */ jsx(
|
|
147
|
+
ContextIcon,
|
|
130
148
|
{
|
|
131
|
-
value: { type
|
|
132
|
-
annotations
|
|
133
|
-
counters
|
|
134
|
-
showExtraIcon:
|
|
135
|
-
disableTooltip:
|
|
149
|
+
value: { type, value, classification },
|
|
150
|
+
annotations,
|
|
151
|
+
counters,
|
|
152
|
+
showExtraIcon: contextIcon,
|
|
153
|
+
disableTooltip: forceDetails,
|
|
136
154
|
style: { flexShrink: 0 }
|
|
137
155
|
}
|
|
138
156
|
),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
|
|
157
|
+
/* @__PURE__ */ jsx(ActionIcon, { counters, value: { type, value, classification }, disableTooltip: forceDetails }),
|
|
158
|
+
loading && !hideLoading && /* @__PURE__ */ jsx(CircularProgress, { color: "primary", size: 16 })
|
|
141
159
|
] }),
|
|
142
|
-
onClick:
|
|
143
|
-
onDelete: !
|
|
144
|
-
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
|
|
145
163
|
}
|
|
146
164
|
);
|
|
147
165
|
}
|
|
148
|
-
)
|
|
166
|
+
);
|
|
167
|
+
const EnrichedChip$1 = memo(EnrichedChip);
|
|
149
168
|
export {
|
|
150
|
-
|
|
169
|
+
EnrichedChip$1 as default
|
|
151
170
|
};
|
|
@@ -10,7 +10,7 @@ export interface EnrichedTypographyProps extends EnrichmentProps {
|
|
|
10
10
|
}
|
|
11
11
|
declare const _default: import('react').NamedExoticComponent<EnrichedTypographyProps & import('@mui/material').TypographyOwnProps & import('@mui/material/OverridableComponent').CommonProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
12
12
|
ref?: import('react').Ref<HTMLSpanElement>;
|
|
13
|
-
}, "fontSize" | "color" | "style" | "left" | "right" | "bottom" | "top" | "flex" | "position" | "border" | "padding" | "children" | "variant" | "classes" | "className" | "margin" | "sx" | "p" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "marginBlock" | "marginInline" | "overflow" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "noWrap" | "
|
|
13
|
+
}, "fontSize" | "color" | "style" | "left" | "right" | "bottom" | "top" | "flex" | "position" | "border" | "padding" | "children" | "variant" | "classes" | "className" | "margin" | "sx" | "p" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "marginBlock" | "marginInline" | "overflow" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "align" | "noWrap" | "gutterBottom" | "paragraph" | "variantMapping"> & {
|
|
14
14
|
component?: React.ElementType;
|
|
15
15
|
}>;
|
|
16
16
|
export default _default;
|
|
@@ -1,152 +1,173 @@
|
|
|
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-CQwKs8se.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, _d;
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
() => !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,
|
|
53
67
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
|
-
[
|
|
68
|
+
[hideDetails, useDetailsIcon, otherProps, type, value, classification]
|
|
55
69
|
);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
type
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (forceDetails) {
|
|
72
|
+
showInfo("details", anchorRef.current, { type, value, classification }, buildOptions());
|
|
73
|
+
} else {
|
|
74
|
+
closeInfo("details", {
|
|
75
|
+
type,
|
|
76
|
+
value,
|
|
77
|
+
classification
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}, [classification, forceDetails, type, value]);
|
|
81
|
+
return /* @__PURE__ */ jsxs(
|
|
82
|
+
Stack,
|
|
64
83
|
{
|
|
65
|
-
ref:
|
|
84
|
+
ref: anchorRef,
|
|
66
85
|
direction: "row",
|
|
67
86
|
spacing: 1,
|
|
68
87
|
alignItems: "center",
|
|
69
|
-
...
|
|
88
|
+
...slotProps == null ? void 0 : slotProps.stack,
|
|
89
|
+
className: `enriched-typography ${((_a = slotProps == null ? void 0 : slotProps.stack) == null ? void 0 : _a.className) ?? ""}`.trim(),
|
|
70
90
|
sx: [
|
|
71
91
|
{
|
|
72
|
-
cursor: !
|
|
92
|
+
cursor: !loading && !hideDetails ? "pointer" : "inherit",
|
|
73
93
|
borderBottom: "1px solid transparent",
|
|
74
|
-
transition:
|
|
94
|
+
transition: theme.transitions.create(["border-bottom-color"]),
|
|
75
95
|
"&:hover": {
|
|
76
|
-
borderBottomColor: !
|
|
96
|
+
borderBottomColor: !loading && (!hideDetails ? theme.palette.primary.light : null)
|
|
77
97
|
}
|
|
78
98
|
},
|
|
79
|
-
...Array.isArray((
|
|
99
|
+
...Array.isArray((_b = slotProps == null ? void 0 : slotProps.stack) == null ? void 0 : _b.sx) ? (_c = slotProps == null ? void 0 : slotProps.stack) == null ? void 0 : _c.sx : [(_d = slotProps == null ? void 0 : slotProps.stack) == null ? void 0 : _d.sx]
|
|
80
100
|
],
|
|
81
|
-
onClick:
|
|
101
|
+
onClick: !useDetailsIcon ? clicker : void 0,
|
|
82
102
|
children: [
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
AssessmentIcon,
|
|
85
105
|
{
|
|
86
|
-
ubiquitous:
|
|
87
|
-
value: { type
|
|
88
|
-
annotations
|
|
89
|
-
counters
|
|
90
|
-
disableTooltip:
|
|
106
|
+
ubiquitous: true,
|
|
107
|
+
value: { type, value, classification },
|
|
108
|
+
annotations,
|
|
109
|
+
counters,
|
|
110
|
+
disableTooltip: forceDetails
|
|
91
111
|
}
|
|
92
112
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
OpinionIcon,
|
|
95
115
|
{
|
|
96
|
-
ubiquitous:
|
|
97
|
-
value: { type
|
|
98
|
-
annotations
|
|
99
|
-
counters
|
|
100
|
-
disableTooltip:
|
|
116
|
+
ubiquitous: true,
|
|
117
|
+
value: { type, value, classification },
|
|
118
|
+
annotations,
|
|
119
|
+
counters,
|
|
120
|
+
disableTooltip: forceDetails
|
|
101
121
|
}
|
|
102
122
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
123
|
+
/* @__PURE__ */ jsx(
|
|
124
|
+
ContextIcon,
|
|
105
125
|
{
|
|
106
|
-
ubiquitous:
|
|
107
|
-
value: { type
|
|
108
|
-
annotations
|
|
109
|
-
counters
|
|
110
|
-
showExtraIcon:
|
|
111
|
-
disableTooltip:
|
|
126
|
+
ubiquitous: true,
|
|
127
|
+
value: { type, value, classification },
|
|
128
|
+
annotations,
|
|
129
|
+
counters,
|
|
130
|
+
showExtraIcon: contextIcon,
|
|
131
|
+
disableTooltip: forceDetails
|
|
112
132
|
}
|
|
113
133
|
),
|
|
114
|
-
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
134
|
+
children ?? /* @__PURE__ */ jsx(FrequencyText, { id: `enriched-${type}-value`, ...otherProps, annotations, value }),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
AssessmentIcon,
|
|
117
137
|
{
|
|
118
|
-
value: { type
|
|
119
|
-
annotations
|
|
120
|
-
counters
|
|
121
|
-
disableTooltip:
|
|
138
|
+
value: { type, value, classification },
|
|
139
|
+
annotations,
|
|
140
|
+
counters,
|
|
141
|
+
disableTooltip: forceDetails
|
|
122
142
|
}
|
|
123
143
|
),
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
OpinionIcon,
|
|
126
146
|
{
|
|
127
|
-
value: { type
|
|
128
|
-
annotations
|
|
129
|
-
counters
|
|
130
|
-
disableTooltip:
|
|
147
|
+
value: { type, value, classification },
|
|
148
|
+
annotations,
|
|
149
|
+
counters,
|
|
150
|
+
disableTooltip: forceDetails
|
|
131
151
|
}
|
|
132
152
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
153
|
+
/* @__PURE__ */ jsx(
|
|
154
|
+
ContextIcon,
|
|
135
155
|
{
|
|
136
|
-
value: { type
|
|
137
|
-
annotations
|
|
138
|
-
counters
|
|
139
|
-
showExtraIcon:
|
|
140
|
-
disableTooltip:
|
|
156
|
+
value: { type, value, classification },
|
|
157
|
+
annotations,
|
|
158
|
+
counters,
|
|
159
|
+
showExtraIcon: contextIcon,
|
|
160
|
+
disableTooltip: forceDetails
|
|
141
161
|
}
|
|
142
162
|
),
|
|
143
|
-
/* @__PURE__ */
|
|
144
|
-
|
|
145
|
-
!
|
|
163
|
+
/* @__PURE__ */ jsx(ActionIcon, { counters, value: { type, value, classification }, disableTooltip: forceDetails }),
|
|
164
|
+
loading && !hideLoading && /* @__PURE__ */ jsx(CircularProgress, { color: "primary", size: 18 }),
|
|
165
|
+
!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
166
|
]
|
|
147
167
|
}
|
|
148
168
|
);
|
|
149
|
-
}
|
|
169
|
+
};
|
|
170
|
+
const EnrichedTypography$1 = memo(EnrichedTypography);
|
|
150
171
|
export {
|
|
151
|
-
|
|
172
|
+
EnrichedTypography$1 as default
|
|
152
173
|
};
|