@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.
Files changed (201) hide show
  1. package/ActionForm-ByeOzpc4.js +555 -0
  2. package/AnnotationDetails-DknbKDyl.js +175 -0
  3. package/AnnotationPreview-CQwKs8se.js +188 -0
  4. package/ClueEnrichContext-6NJfXpUB.js +536 -0
  5. package/FlexOne-BSYAhhtG.js +9 -0
  6. package/_Map-kgDsDYxq.js +64 -0
  7. package/_MapCache-DabaaWfq.js +161 -0
  8. package/_Uint8Array-BlVVH1tp.js +129 -0
  9. package/_baseAssignValue-CNbcU6Nb.js +25 -0
  10. package/_baseClone-D3a8Pa4T.js +284 -0
  11. package/_baseExtremum-B1o1zHjR.js +33 -0
  12. package/_baseFlatten-D4huXoEI.js +92 -0
  13. package/_baseGet-BSK_nnoz.js +109 -0
  14. package/_baseIsEqual-B5xLoweL.js +238 -0
  15. package/_baseIteratee-p6Nj07-n.js +126 -0
  16. package/_baseSlice-GAv_YFTT.js +20 -0
  17. package/_baseSum-D0WC1dN0.js +13 -0
  18. package/_baseUniq-CpupKWcL.js +89 -0
  19. package/_commonjsHelpers-DWwsNxpa.js +8 -0
  20. package/_createAggregator-BpVy5xMi.js +63 -0
  21. package/_getPrototype-D1LAdQKO.js +5 -0
  22. package/_getTag-D3ToyefI.js +126 -0
  23. package/api/lookup/index.d.ts +1 -1
  24. package/api/lookup/types.d.ts +2 -2
  25. package/api/lookup/types_detection.d.ts +2 -2
  26. package/cloneDeep-CjP5k9zW.js +8 -0
  27. package/components/AnnotationBody.js +49 -34
  28. package/components/AnnotationDetailPopover.js +36 -30
  29. package/components/AnnotationDetails.js +6 -6
  30. package/components/AnnotationEntry.js +50 -47
  31. package/components/AnnotationPreview.js +5 -5
  32. package/components/ClassificationChip.d.ts +2 -1
  33. package/components/ClassificationChip.js +44 -23
  34. package/components/CountBadge.js +31 -26
  35. package/components/EnrichedCard.js +110 -92
  36. package/components/EnrichedChip.js +130 -111
  37. package/components/EnrichedTypography.d.ts +1 -1
  38. package/components/EnrichedTypography.js +133 -112
  39. package/components/ErrorBoundary.js +28 -24
  40. package/components/RetryFailedEnrichments.js +10 -9
  41. package/components/SourcePicker.js +57 -49
  42. package/components/actions/ActionForm.js +4 -4
  43. package/components/actions/ExecutePopover.js +64 -50
  44. package/components/actions/ResultModal.js +12 -41
  45. package/components/actions/form/schemaAdapter.js +40 -20
  46. package/components/display/graph/ExpandMoreButton.js +10 -10
  47. package/components/display/graph/elements/NodeCard.js +114 -76
  48. package/components/display/graph/elements/NodeTag.js +15 -13
  49. package/components/display/graph/index.js +267 -210
  50. package/components/display/graph/visualizations/Leaf.js +88 -69
  51. package/components/display/graph/visualizations/cloud/index.js +98 -81
  52. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  53. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  55. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  56. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  57. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  58. package/components/display/graph/visualizations/icons/index.js +14 -13
  59. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  60. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  61. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  62. package/components/display/graph/visualizations/tree/index.js +407 -305
  63. package/components/display/icons/Iconified.js +27 -12
  64. package/components/display/json/index.js +4 -4
  65. package/components/display/markdown/index.js +8696 -5668
  66. package/components/enrichment/EnrichPopover.js +55 -47
  67. package/components/fetchers/Fetcher.js +123 -95
  68. package/components/fetchers/PreviewModal.js +20 -17
  69. package/components/fetchers/StatusChip.js +21 -18
  70. package/components/group/Entry.js +13 -11
  71. package/components/group/Group.js +13 -10
  72. package/components/group/GroupControl.js +78 -66
  73. package/components/stats/QueryStatus.js +44 -31
  74. package/countBy-C69WslUA.js +14 -0
  75. package/data/event.js +6 -4
  76. package/database/index.js +2 -2
  77. package/debounce-bV0h5FC5.js +92 -0
  78. package/en/translation.json +39 -59
  79. package/fr/translation.json +37 -56
  80. package/get-D3C3lEU3.js +8 -0
  81. package/groupBy-DC2oOuBN.js +14 -0
  82. package/hooks/ClueActionContext.d.ts +26 -0
  83. package/hooks/ClueActionContext.js +8 -7
  84. package/hooks/ClueComponentContext.js +29 -23
  85. package/hooks/ClueConfigProvider.js +14 -12
  86. package/hooks/ClueDatabaseContext.js +19 -13
  87. package/hooks/ClueEnrichContext.js +8 -8
  88. package/hooks/ClueEnrichProps.d.ts +3 -1
  89. package/hooks/ClueFetcherContext.js +74 -46
  90. package/hooks/ClueGroupContext.js +17 -14
  91. package/hooks/CluePopupContext.js +5 -5
  92. package/hooks/ClueProvider.js +12 -10
  93. package/hooks/selectors.d.ts +4 -5
  94. package/hooks/selectors.js +21 -11
  95. package/hooks/useActionResult.d.ts +14 -0
  96. package/hooks/useActionResult.js +5 -0
  97. package/hooks/useAnnotations.js +45 -29
  98. package/hooks/useClue.js +6 -4
  99. package/hooks/useClueActions.d.ts +1 -1
  100. package/hooks/useClueActions.js +3 -3
  101. package/hooks/useClueConfig.d.ts +2 -1
  102. package/hooks/useClueConfig.js +6 -6
  103. package/hooks/useClueTypeConfig.js +3 -3
  104. package/hooks/useComparator.js +722 -435
  105. package/hooks/useErrors.js +22 -18
  106. package/hooks/useMyHighlights.js +66 -36
  107. package/hooks/useMyLocalStorage.d.ts +4 -3
  108. package/hooks/useMyLocalStorage.js +66 -46
  109. package/iconify-CXMreGTg.js +1782 -0
  110. package/icons/Action.js +66 -49
  111. package/icons/Assessment.js +84 -68
  112. package/icons/Context.js +78 -61
  113. package/icons/Opinion.js +77 -65
  114. package/icons/iconMap.js +2 -2
  115. package/identity-CPGTqrE4.js +6 -0
  116. package/index-BDVjGvMI.js +696 -0
  117. package/index-BbPn6-Mw.js +15750 -0
  118. package/index-Bi21Wb23.js +465 -0
  119. package/index-C3lkTD69.js +1172 -0
  120. package/index-CC12Ux-9.js +17654 -0
  121. package/isEmpty-BQkZubqU.js +29 -0
  122. package/isNil-CIubwp4T.js +6 -0
  123. package/isObject-FTY-5JQX.js +7 -0
  124. package/isObjectLike-OAgjjZye.js +48 -0
  125. package/isSymbol-Xd2FsJyp.js +8 -0
  126. package/last-CUCl67Im.js +7 -0
  127. package/main.js +62 -62
  128. package/package.json +3 -3
  129. package/sortBy-B-UKp4GT.js +100 -0
  130. package/sumBy-MYkDPHZL.js +8 -0
  131. package/text/Frequency.js +42 -23
  132. package/toFinite-Bc55msYj.js +16 -0
  133. package/toNumber-DPxy1FBy.js +39 -0
  134. package/types/RunningActionData.d.ts +4 -3
  135. package/types/action.d.ts +10 -1
  136. package/useClueTypeConfig-XvGvIw2S.js +3201 -0
  137. package/utils/chain.js +91 -64
  138. package/utils/classificationParser.js +519 -256
  139. package/utils/constants.js +35 -10
  140. package/utils/graph.js +72 -45
  141. package/utils/hashUtil.js +7 -7
  142. package/utils/line.js +131 -81
  143. package/utils/loggerUtil.d.ts +1 -1
  144. package/utils/loggerUtil.js +6 -4
  145. package/utils/sessionStorage.js +41 -29
  146. package/utils/time.d.ts +3 -0
  147. package/utils/time.js +536 -0
  148. package/utils/utils.js +10 -9
  149. package/utils/window.js +21 -10
  150. package/utils-7OtvGnmf.js +200 -0
  151. package/ActionForm-Sw7D-KOE.js +0 -340
  152. package/AnnotationDetails-BoX61_IF.js +0 -160
  153. package/AnnotationPreview-dYinoSA9.js +0 -140
  154. package/ClueEnrichContext-CvCIPOMC.js +0 -412
  155. package/FlexOne-BXWFOd1T.js +0 -6
  156. package/_Map-DXNg_Z-q.js +0 -54
  157. package/_MapCache-Cu25RRDU.js +0 -129
  158. package/_Uint8Array-DlJCtTvG.js +0 -102
  159. package/_baseAssignValue-CUmzp727.js +0 -20
  160. package/_baseClone-BlMmRXeX.js +0 -208
  161. package/_baseExtremum-P_0akmCi.js +0 -27
  162. package/_baseFlatten-CN7vDNEQ.js +0 -72
  163. package/_baseGet-Dgf6_xCm.js +0 -80
  164. package/_baseIsEqual-Cpjtfb3Q.js +0 -173
  165. package/_baseIteratee-CP1bocOX.js +0 -95
  166. package/_baseSlice-M5RKzt1A.js +0 -10
  167. package/_baseSum-wEbgNeUs.js +0 -10
  168. package/_baseUniq-tMFmk80M.js +0 -61
  169. package/_commonjsHelpers-C6fGbg64.js +0 -6
  170. package/_createAggregator-B4Cav8ZM.js +0 -53
  171. package/_getPrototype-CHAFQYL_.js +0 -5
  172. package/_getTag-BV_UoLYG.js +0 -90
  173. package/cloneDeep-BPVpFBzJ.js +0 -8
  174. package/components/display/markdown/DynamicTabs.d.ts +0 -8
  175. package/components/display/markdown/DynamicTabs.js +0 -21
  176. package/components/display/markdown/markdownPlugins/tabs.d.ts +0 -3
  177. package/components/display/markdown/markdownPlugins/tabs.js +0 -4
  178. package/countBy-DOutsa_w.js +0 -8
  179. package/debounce-DryYcbJ4.js +0 -56
  180. package/get-Bow1vKwx.js +0 -8
  181. package/groupBy-BheQYl6f.js +0 -8
  182. package/iconify-BBckr5AQ.js +0 -1263
  183. package/identity-ByMq8VxU.js +0 -6
  184. package/index-CnaCBNrd.js +0 -358
  185. package/index-E7g8cRyW.js +0 -568
  186. package/index-V7wwd05F.js +0 -975
  187. package/index-p5_wX7q1.js +0 -11729
  188. package/index-pQg5VUAZ.js +0 -12734
  189. package/isEmpty-g47Qir2A.js +0 -21
  190. package/isNil-CjWwlQS3.js +0 -6
  191. package/isObject-B53jY8Qg.js +0 -7
  192. package/isObjectLike-BatpeCIi.js +0 -29
  193. package/isSymbol-C3_SC0Qp.js +0 -8
  194. package/last-7CdUxN0r.js +0 -7
  195. package/sortBy-ITdmD17L.js +0 -79
  196. package/sumBy-DxJUU2E8.js +0 -8
  197. package/tabs-CgADNA57.js +0 -195
  198. package/toFinite-BMy6GObD.js +0 -14
  199. package/toNumber-YVhnnJv4.js +0 -31
  200. package/useClueTypeConfig-CneP98N_.js +0 -2260
  201. package/utils-CD0rFIFU.js +0 -2704
@@ -1,151 +1,170 @@
1
- import { jsx as l, jsxs as O } from "react/jsx-runtime";
2
- import { Chip as B, Tooltip as G, Box as $, Stack as H, CircularProgress as J } from "@mui/material";
3
- import K from "./display/icons/Iconified.js";
4
- import { ClueComponentContext as L } from "../hooks/ClueComponentContext.js";
5
- import { ClueGroupContext as N } from "../hooks/ClueGroupContext.js";
6
- import { C as E } from "../AnnotationPreview-dYinoSA9.js";
7
- import { useClueEnrichSelector as Q } from "../hooks/selectors.js";
8
- import U from "../hooks/useAnnotations.js";
9
- import V from "../icons/Action.js";
10
- import v from "../icons/Assessment.js";
11
- import q from "../icons/Context.js";
12
- import z from "../icons/Opinion.js";
13
- import W from "../text/Frequency.js";
14
- import X, { useRef as Y, useMemo as x, useCallback as Z, useEffect as _, memo as F } from "react";
15
- import { u as d } from "../index-E7g8cRyW.js";
16
- const D = X.memo(
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: b,
19
- value: o,
20
- classification: k,
21
- contextIcon: y = !1,
22
- counters: a = !1,
23
- hideDetails: T = !1,
24
- hideLoading: A = !1,
25
- forceDetails: f = !1,
26
- setForceDetails: u = null,
27
- useDetailsIcon: p = !1,
28
- skipEnrichment: R = !1,
29
- slotProps: s = {},
30
- ...t
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: j } = d(L, (i) => i.i18next), C = Y(), S = d(N, (i) => i == null ? void 0 : i.type), w = Q((i) => i.defaultClassification), n = x(() => b ?? S, [b, S]), e = x(
33
- () => k ?? w,
34
- [k, w]
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 (!n)
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
- const [m, c] = U(n, o, e, { skipEnrichment: R }), g = d(E, (i) => i.showInfo), M = d(E, (i) => i.closeInfo), h = Z(() => {
39
- const i = {};
40
- return u && (i.onClose = () => u(!1)), s != null && s.popover && (i.popoverProps = s.popover), i;
41
- }, [u, s.popover]), I = x(
42
- () => c ? (
43
- // We need to give a dummy callback when loading so the popover doesn't get confused
44
- (i) => {
45
- var r;
46
- (r = t.onClick) == null || r.call(t, i);
47
- }
48
- ) : !T || p ? (i) => {
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,
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
- [c, T, p, t, n, o, e]
66
+ [hideDetails, useDetailsIcon, otherProps, type, value, classification]
54
67
  );
55
- return _(() => {
56
- f ? g("details", C.current, { type: n, value: o, classification: e }, h()) : M("details", {
57
- type: n,
58
- value: o,
59
- classification: e
60
- });
61
- }, [e, f, n, o]), /* @__PURE__ */ l(
62
- B,
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
- ...t,
65
- ref: C,
66
- variant: t.variant || "outlined",
82
+ ...otherProps,
83
+ ref: anchorRef,
84
+ variant: otherProps.variant || "outlined",
67
85
  sx: {
68
- height: t.size !== "small" ? "40px" : "unset",
86
+ height: otherProps.size !== "small" ? "40px" : "unset",
69
87
  "& .MuiChip-label": { overflow: "visible" },
70
- ...t.sx ?? {}
88
+ ...otherProps.sx ?? {}
71
89
  },
72
- label: /* @__PURE__ */ O(H, { direction: "row", spacing: 1, alignItems: "center", children: [
73
- /* @__PURE__ */ l(
74
- v,
90
+ label: /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
91
+ /* @__PURE__ */ jsx(
92
+ AssessmentIcon,
75
93
  {
76
- ubiquitous: !0,
77
- value: { type: n, value: o, classification: e },
78
- annotations: m,
79
- counters: a,
80
- disableTooltip: f,
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__ */ l(
85
- z,
102
+ /* @__PURE__ */ jsx(
103
+ OpinionIcon,
86
104
  {
87
- ubiquitous: !0,
88
- value: { type: n, value: o, classification: e },
89
- annotations: m,
90
- counters: a,
91
- disableTooltip: f,
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__ */ l(
96
- q,
113
+ /* @__PURE__ */ jsx(
114
+ ContextIcon,
97
115
  {
98
- ubiquitous: !0,
99
- value: { type: n, value: o, classification: e },
100
- annotations: m,
101
- counters: a,
102
- showExtraIcon: y,
103
- disableTooltip: f,
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
- t.label ?? /* @__PURE__ */ l(W, { fontSize: "inherit", annotations: m, value: o }),
108
- /* @__PURE__ */ l(
109
- v,
125
+ otherProps.label ?? /* @__PURE__ */ jsx(FrequencyText, { fontSize: "inherit", annotations, value }),
126
+ /* @__PURE__ */ jsx(
127
+ AssessmentIcon,
110
128
  {
111
- value: { type: n, value: o, classification: e },
112
- annotations: m,
113
- counters: a,
114
- disableTooltip: f,
129
+ value: { type, value, classification },
130
+ annotations,
131
+ counters,
132
+ disableTooltip: forceDetails,
115
133
  style: { flexShrink: 0 }
116
134
  }
117
135
  ),
118
- /* @__PURE__ */ l(
119
- z,
136
+ /* @__PURE__ */ jsx(
137
+ OpinionIcon,
120
138
  {
121
- value: { type: n, value: o, classification: e },
122
- annotations: m,
123
- counters: a,
124
- disableTooltip: f,
139
+ value: { type, value, classification },
140
+ annotations,
141
+ counters,
142
+ disableTooltip: forceDetails,
125
143
  style: { flexShrink: 0 }
126
144
  }
127
145
  ),
128
- /* @__PURE__ */ l(
129
- q,
146
+ /* @__PURE__ */ jsx(
147
+ ContextIcon,
130
148
  {
131
- value: { type: n, value: o, classification: e },
132
- annotations: m,
133
- counters: a,
134
- showExtraIcon: y,
135
- disableTooltip: f,
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__ */ l(V, { counters: a, value: { type: n, value: o, classification: e }, disableTooltip: f }),
140
- c && !A && /* @__PURE__ */ l(J, { color: "primary", size: 16 })
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: p ? void 0 : I,
143
- onDelete: !c && p ? I : void 0,
144
- deleteIcon: p ? /* @__PURE__ */ l(G, { title: j("details.open"), children: /* @__PURE__ */ l($, { component: "span", sx: { pr: 1 }, children: /* @__PURE__ */ l(K, { icon: "ic:outline-info" }) }) }) : null
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
- ), ui = F(D);
166
+ );
167
+ const EnrichedChip$1 = memo(EnrichedChip);
149
168
  export {
150
- ui as default
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" | "paragraph" | "gutterBottom" | "variantMapping"> & {
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 as J, jsx as a } from "react/jsx-runtime";
2
- import { useTheme as K, Stack as L, CircularProgress as N, Tooltip as Q, IconButton as U } from "@mui/material";
3
- import V from "./display/icons/Iconified.js";
4
- import { ClueComponentContext as W } from "../hooks/ClueComponentContext.js";
5
- import { ClueGroupContext as X } from "../hooks/ClueGroupContext.js";
6
- import { C as S } from "../AnnotationPreview-dYinoSA9.js";
7
- import { useClueEnrichSelector as Y } from "../hooks/selectors.js";
8
- import Z from "../hooks/useAnnotations.js";
9
- import F from "../icons/Action.js";
10
- import j from "../icons/Assessment.js";
11
- import z from "../icons/Context.js";
12
- import O from "../icons/Opinion.js";
13
- import _ from "../text/Frequency.js";
14
- import { memo as D, useRef as P, useMemo as y, useCallback as ii, useEffect as ni } from "react";
15
- import { u as C } from "../index-E7g8cRyW.js";
16
- const oi = ({
17
- type: k,
18
- value: t,
19
- classification: s,
20
- contextIcon: g = !1,
21
- counters: r = !1,
22
- hideDetails: l = !1,
23
- hideLoading: R = !1,
24
- forceDetails: c = !1,
25
- setForceDetails: b = null,
26
- useDetailsIcon: p = !1,
27
- skipEnrichment: $ = !1,
28
- slotProps: n = {},
29
- children: G,
30
- ...m
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 q, v, B;
33
- const { t: M } = C(W, (i) => i.i18next), x = K(), T = P(), I = C(X, (i) => i == null ? void 0 : i.type), w = Y((i) => i.defaultClassification), o = y(() => k ?? I, [k, I]), e = y(
34
- () => s ?? w,
35
- [s, w]
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 (!o)
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
- const [f, d] = Z(o, t, e, { skipEnrichment: $ }), E = C(S, (i) => i.showInfo), H = C(S, (i) => i.closeInfo), h = ii(() => {
40
- const i = {};
41
- return b && (i.onClose = () => b(!1)), n != null && n.popover && (i.popoverProps = n.popover), i;
42
- }, [b, n.popover]), A = y(
43
- () => d ? (
44
- // We need to give a dummy callback when loading so the popover doesn't get confused
45
- (i) => {
46
- var u;
47
- (u = m.onClick) == null || u.call(m, i);
48
- }
49
- ) : !l || p ? (i) => {
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,
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
- [d, l, p, m, o, t, e]
68
+ [hideDetails, useDetailsIcon, otherProps, type, value, classification]
55
69
  );
56
- return ni(() => {
57
- c ? E("details", T.current, { type: o, value: t, classification: e }, h()) : H("details", {
58
- type: o,
59
- value: t,
60
- classification: e
61
- });
62
- }, [e, c, o, t]), /* @__PURE__ */ J(
63
- L,
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: T,
84
+ ref: anchorRef,
66
85
  direction: "row",
67
86
  spacing: 1,
68
87
  alignItems: "center",
69
- ...n == null ? void 0 : n.stack,
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: !d && !l ? "pointer" : "inherit",
92
+ cursor: !loading && !hideDetails ? "pointer" : "inherit",
73
93
  borderBottom: "1px solid transparent",
74
- transition: x.transitions.create(["border-bottom-color"]),
94
+ transition: theme.transitions.create(["border-bottom-color"]),
75
95
  "&:hover": {
76
- borderBottomColor: !d && (l ? null : x.palette.primary.light)
96
+ borderBottomColor: !loading && (!hideDetails ? theme.palette.primary.light : null)
77
97
  }
78
98
  },
79
- ...Array.isArray((q = n == null ? void 0 : n.stack) == null ? void 0 : q.sx) ? (v = n == null ? void 0 : n.stack) == null ? void 0 : v.sx : [(B = n == null ? void 0 : n.stack) == null ? void 0 : B.sx]
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: p ? void 0 : A,
101
+ onClick: !useDetailsIcon ? clicker : void 0,
82
102
  children: [
83
- /* @__PURE__ */ a(
84
- j,
103
+ /* @__PURE__ */ jsx(
104
+ AssessmentIcon,
85
105
  {
86
- ubiquitous: !0,
87
- value: { type: o, value: t, classification: e },
88
- annotations: f,
89
- counters: r,
90
- disableTooltip: c
106
+ ubiquitous: true,
107
+ value: { type, value, classification },
108
+ annotations,
109
+ counters,
110
+ disableTooltip: forceDetails
91
111
  }
92
112
  ),
93
- /* @__PURE__ */ a(
94
- O,
113
+ /* @__PURE__ */ jsx(
114
+ OpinionIcon,
95
115
  {
96
- ubiquitous: !0,
97
- value: { type: o, value: t, classification: e },
98
- annotations: f,
99
- counters: r,
100
- disableTooltip: c
116
+ ubiquitous: true,
117
+ value: { type, value, classification },
118
+ annotations,
119
+ counters,
120
+ disableTooltip: forceDetails
101
121
  }
102
122
  ),
103
- /* @__PURE__ */ a(
104
- z,
123
+ /* @__PURE__ */ jsx(
124
+ ContextIcon,
105
125
  {
106
- ubiquitous: !0,
107
- value: { type: o, value: t, classification: e },
108
- annotations: f,
109
- counters: r,
110
- showExtraIcon: g,
111
- disableTooltip: c
126
+ ubiquitous: true,
127
+ value: { type, value, classification },
128
+ annotations,
129
+ counters,
130
+ showExtraIcon: contextIcon,
131
+ disableTooltip: forceDetails
112
132
  }
113
133
  ),
114
- G ?? /* @__PURE__ */ a(_, { id: `enriched-${o}-value`, ...m, annotations: f, value: t }),
115
- /* @__PURE__ */ a(
116
- j,
134
+ children ?? /* @__PURE__ */ jsx(FrequencyText, { id: `enriched-${type}-value`, ...otherProps, annotations, value }),
135
+ /* @__PURE__ */ jsx(
136
+ AssessmentIcon,
117
137
  {
118
- value: { type: o, value: t, classification: e },
119
- annotations: f,
120
- counters: r,
121
- disableTooltip: c
138
+ value: { type, value, classification },
139
+ annotations,
140
+ counters,
141
+ disableTooltip: forceDetails
122
142
  }
123
143
  ),
124
- /* @__PURE__ */ a(
125
- O,
144
+ /* @__PURE__ */ jsx(
145
+ OpinionIcon,
126
146
  {
127
- value: { type: o, value: t, classification: e },
128
- annotations: f,
129
- counters: r,
130
- disableTooltip: c
147
+ value: { type, value, classification },
148
+ annotations,
149
+ counters,
150
+ disableTooltip: forceDetails
131
151
  }
132
152
  ),
133
- /* @__PURE__ */ a(
134
- z,
153
+ /* @__PURE__ */ jsx(
154
+ ContextIcon,
135
155
  {
136
- value: { type: o, value: t, classification: e },
137
- annotations: f,
138
- counters: r,
139
- showExtraIcon: g,
140
- disableTooltip: c
156
+ value: { type, value, classification },
157
+ annotations,
158
+ counters,
159
+ showExtraIcon: contextIcon,
160
+ disableTooltip: forceDetails
141
161
  }
142
162
  ),
143
- /* @__PURE__ */ a(F, { counters: r, value: { type: o, value: t, classification: e }, disableTooltip: c }),
144
- d && !R && /* @__PURE__ */ a(N, { color: "primary", size: 18 }),
145
- !d && p && /* @__PURE__ */ a(Q, { title: M("details.open"), children: /* @__PURE__ */ a(U, { size: "small", onClick: A, sx: { color: x.palette.action.disabled }, children: /* @__PURE__ */ a(V, { icon: "ic:outline-info" }) }) })
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
- }, yi = D(oi);
169
+ };
170
+ const EnrichedTypography$1 = memo(EnrichedTypography);
150
171
  export {
151
- yi as default
172
+ EnrichedTypography$1 as default
152
173
  };