@uipath/apollo-react 7.35.0 → 7.37.0

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 (124) hide show
  1. package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +4 -4
  2. package/dist/canvas/components/BaseNode/BaseNodeContainer.js +4 -4
  3. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  4. package/dist/chat/styles/tailwind.chat.css +1 -1
  5. package/dist/decision-table/CitationButton.cjs +72 -0
  6. package/dist/decision-table/CitationButton.d.ts +33 -0
  7. package/dist/decision-table/CitationButton.d.ts.map +1 -0
  8. package/dist/decision-table/CitationButton.js +35 -0
  9. package/dist/decision-table/DecisionGraphCard.cjs +16 -2
  10. package/dist/decision-table/DecisionGraphCard.d.ts +5 -0
  11. package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
  12. package/dist/decision-table/DecisionGraphCard.js +17 -3
  13. package/dist/decision-table/DecisionGraphText.cjs +417 -6
  14. package/dist/decision-table/DecisionGraphText.d.ts +22 -4
  15. package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
  16. package/dist/decision-table/DecisionGraphText.js +418 -7
  17. package/dist/decision-table/DecisionText.cjs +31 -2
  18. package/dist/decision-table/DecisionText.d.ts +6 -5
  19. package/dist/decision-table/DecisionText.d.ts.map +1 -1
  20. package/dist/decision-table/DecisionText.js +31 -2
  21. package/dist/decision-table/DecisionTextHeader.cjs +17 -1
  22. package/dist/decision-table/DecisionTextHeader.d.ts +7 -1
  23. package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -1
  24. package/dist/decision-table/DecisionTextHeader.js +18 -2
  25. package/dist/decision-table/RuleCard.cjs +60 -26
  26. package/dist/decision-table/RuleCard.d.ts +2 -0
  27. package/dist/decision-table/RuleCard.d.ts.map +1 -1
  28. package/dist/decision-table/RuleCard.js +61 -27
  29. package/dist/decision-table/RuleList.cjs +2 -1
  30. package/dist/decision-table/RuleList.d.ts +1 -0
  31. package/dist/decision-table/RuleList.d.ts.map +1 -1
  32. package/dist/decision-table/RuleList.js +2 -1
  33. package/dist/decision-table/__fixtures__/storyTableHost.d.ts +4 -2
  34. package/dist/decision-table/__fixtures__/storyTableHost.d.ts.map +1 -1
  35. package/dist/decision-table/__fixtures__/textMode.d.ts +6 -3
  36. package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
  37. package/dist/decision-table/__fixtures__/useStoryHistory.d.ts +7 -0
  38. package/dist/decision-table/__fixtures__/useStoryHistory.d.ts.map +1 -0
  39. package/dist/decision-table/decisionGraphActionTypes.d.ts +8 -0
  40. package/dist/decision-table/decisionGraphActionTypes.d.ts.map +1 -1
  41. package/dist/decision-table/decisionGraphTypes.d.ts +8 -0
  42. package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
  43. package/dist/decision-table/index.cjs +56 -56
  44. package/dist/decision-table/index.d.ts +4 -4
  45. package/dist/decision-table/index.d.ts.map +1 -1
  46. package/dist/decision-table/index.js +2 -2
  47. package/dist/decision-table/locales/de.cjs +1 -1
  48. package/dist/decision-table/locales/de.d.ts.map +1 -1
  49. package/dist/decision-table/locales/de.js +1 -1
  50. package/dist/decision-table/locales/en.cjs +1 -1
  51. package/dist/decision-table/locales/en.d.ts.map +1 -1
  52. package/dist/decision-table/locales/en.js +1 -1
  53. package/dist/decision-table/locales/es-MX.cjs +1 -1
  54. package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
  55. package/dist/decision-table/locales/es-MX.js +1 -1
  56. package/dist/decision-table/locales/es.cjs +1 -1
  57. package/dist/decision-table/locales/es.d.ts.map +1 -1
  58. package/dist/decision-table/locales/es.js +1 -1
  59. package/dist/decision-table/locales/fr.cjs +1 -1
  60. package/dist/decision-table/locales/fr.d.ts.map +1 -1
  61. package/dist/decision-table/locales/fr.js +1 -1
  62. package/dist/decision-table/locales/ja.cjs +1 -1
  63. package/dist/decision-table/locales/ja.d.ts.map +1 -1
  64. package/dist/decision-table/locales/ja.js +1 -1
  65. package/dist/decision-table/locales/ko.cjs +1 -1
  66. package/dist/decision-table/locales/ko.d.ts.map +1 -1
  67. package/dist/decision-table/locales/ko.js +1 -1
  68. package/dist/decision-table/locales/pt-BR.cjs +1 -1
  69. package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
  70. package/dist/decision-table/locales/pt-BR.js +1 -1
  71. package/dist/decision-table/locales/pt.cjs +1 -1
  72. package/dist/decision-table/locales/pt.d.ts.map +1 -1
  73. package/dist/decision-table/locales/pt.js +1 -1
  74. package/dist/decision-table/locales/ro.cjs +1 -1
  75. package/dist/decision-table/locales/ro.d.ts.map +1 -1
  76. package/dist/decision-table/locales/ro.js +1 -1
  77. package/dist/decision-table/locales/ru.cjs +1 -1
  78. package/dist/decision-table/locales/ru.d.ts.map +1 -1
  79. package/dist/decision-table/locales/ru.js +1 -1
  80. package/dist/decision-table/locales/tr.cjs +1 -1
  81. package/dist/decision-table/locales/tr.d.ts.map +1 -1
  82. package/dist/decision-table/locales/tr.js +1 -1
  83. package/dist/decision-table/locales/zh-CN.cjs +1 -1
  84. package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
  85. package/dist/decision-table/locales/zh-CN.js +1 -1
  86. package/dist/decision-table/locales/zh-TW.cjs +1 -1
  87. package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
  88. package/dist/decision-table/locales/zh-TW.js +1 -1
  89. package/dist/decision-table/ruleCardModel.d.ts +2 -1
  90. package/dist/decision-table/ruleCardModel.d.ts.map +1 -1
  91. package/dist/decision-table/sentenceSelection.cjs +15 -1
  92. package/dist/decision-table/sentenceSelection.d.ts +3 -1
  93. package/dist/decision-table/sentenceSelection.d.ts.map +1 -1
  94. package/dist/decision-table/sentenceSelection.js +9 -1
  95. package/dist/decision-table/sentenceStyles.cjs +33 -6
  96. package/dist/decision-table/sentenceStyles.d.ts +8 -1
  97. package/dist/decision-table/sentenceStyles.d.ts.map +1 -1
  98. package/dist/decision-table/sentenceStyles.js +9 -3
  99. package/dist/decision-table/sentenceTypes.d.ts +28 -0
  100. package/dist/decision-table/sentenceTypes.d.ts.map +1 -1
  101. package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
  102. package/dist/decision-table/useContainerHandlers.cjs +99 -3
  103. package/dist/decision-table/useContainerHandlers.d.ts +15 -1
  104. package/dist/decision-table/useContainerHandlers.d.ts.map +1 -1
  105. package/dist/decision-table/useContainerHandlers.js +100 -4
  106. package/dist/decision-table/useDecisionGraphStrings.cjs +6 -2
  107. package/dist/decision-table/useDecisionGraphStrings.d.ts +2 -1
  108. package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
  109. package/dist/decision-table/useDecisionGraphStrings.js +6 -2
  110. package/dist/decision-table/useDecisionTextStrings.cjs +36 -0
  111. package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
  112. package/dist/decision-table/useDecisionTextStrings.js +36 -0
  113. package/dist/decision-table/useSentenceNavigation.cjs +5 -6
  114. package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -1
  115. package/dist/decision-table/useSentenceNavigation.js +1 -2
  116. package/package.json +2 -2
  117. package/dist/decision-table/DecisionGraphView.cjs +0 -435
  118. package/dist/decision-table/DecisionGraphView.d.ts +0 -19
  119. package/dist/decision-table/DecisionGraphView.d.ts.map +0 -1
  120. package/dist/decision-table/DecisionGraphView.js +0 -401
  121. package/dist/decision-table/EditableDecisionGraphText.cjs +0 -40
  122. package/dist/decision-table/EditableDecisionGraphText.d.ts +0 -5
  123. package/dist/decision-table/EditableDecisionGraphText.d.ts.map +0 -1
  124. package/dist/decision-table/EditableDecisionGraphText.js +0 -6
@@ -1,10 +1,421 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { DecisionGraphView } from "./DecisionGraphView.js";
3
- const READ = {
4
- kind: 'read'
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { cn } from "@uipath/apollo-wind";
3
+ import { Plus } from "lucide-react";
4
+ import { useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
5
+ import { DecisionGraphCard, DecisionGraphReference } from "./DecisionGraphCard.js";
6
+ import { DecisionGraphMinimapSlot } from "./DecisionGraphMinimapSlot.js";
7
+ import { DecisionText } from "./DecisionText.js";
8
+ import { childPositionsOf, decisionsOf, topPositionsOf, usersOf } from "./decisionGraphPositions.js";
9
+ import { GRAPH_ADD_DECISION_CLASS, GRAPH_BRANCH_CLASS, GRAPH_COLUMN_CLASS, GRAPH_EMPTY_CLASS, GRAPH_FRAME_CLASS, GRAPH_MINIMAP_GAP_PX, GRAPH_NEST_CLASS, GRAPH_OUTPUT_HUE_CLASS, GRAPH_SCROLLER_CLASS, graphColumnInsetOf } from "./decisionGraphStyles.js";
10
+ import { revealIn } from "./revealIn.js";
11
+ import { SENTENCE_MIN_RULE_HEIGHT_PX } from "./sentenceRuleHeights.js";
12
+ import { useDecisionGraphActions } from "./useDecisionGraphActions.js";
13
+ import { useDecisionGraphLabels } from "./useDecisionGraphStrings.js";
14
+ import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
15
+ import { useTextAnnouncements } from "./useTextAnnouncements.js";
16
+ const NO_CITATIONS = {
17
+ kind: 'none'
5
18
  };
6
- const DecisionGraphText = (props)=>/*#__PURE__*/ jsx(DecisionGraphView, {
7
- ...props,
8
- mode: READ
19
+ const NO_EXPANDED = new Set();
20
+ const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
21
+ kind: 'rule',
22
+ decisionId: id,
23
+ rowId: mark.rowId
24
+ } : {
25
+ kind: 'decision',
26
+ decisionId: id
27
+ };
28
+ const citationOf = (citations, decisionId)=>{
29
+ const cited = 'cited' === citations.kind ? citations.decisions.get(decisionId) ?? [] : [];
30
+ return 'cited' === citations.kind && cited.length > 0 ? {
31
+ citations: cited,
32
+ onOpen: citations.onOpenCitation
33
+ } : null;
34
+ };
35
+ const focuses = (mode)=>'navigate' === mode.kind && mode.focus;
36
+ const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
37
+ const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
38
+ const flash = (element)=>{
39
+ if (prefersReducedMotion()) return;
40
+ element.animate?.([
41
+ {
42
+ boxShadow: '0 0 0 4px color-mix(in srgb, var(--color-primary) 40%, transparent)'
43
+ },
44
+ {
45
+ boxShadow: '0 0 0 0 transparent'
46
+ }
47
+ ], {
48
+ duration: 1400,
49
+ easing: 'ease-out'
50
+ });
51
+ };
52
+ const NEAR_MARGIN = '100% 0px';
53
+ const nearAfter = (current, entries)=>{
54
+ let next;
55
+ for (const { target, isIntersecting } of entries){
56
+ const decisionId = target instanceof HTMLElement ? target.dataset.decisionId : void 0;
57
+ if (void 0 !== decisionId && (next ?? current).has(decisionId) !== isIntersecting) {
58
+ next ??= new Set(current);
59
+ if (isIntersecting) next.add(decisionId);
60
+ else next.delete(decisionId);
61
+ }
62
+ }
63
+ return next ?? current;
64
+ };
65
+ const bodyHeightOf = (card)=>{
66
+ const body = card.querySelector(':scope > [data-graph-body]');
67
+ if (!body || body.querySelector(':scope > [data-graph-placeholder]')) return null;
68
+ return body.offsetHeight || null;
69
+ };
70
+ const ruleCountsOf = (nodes)=>{
71
+ const counts = new Map();
72
+ const visit = (node)=>{
73
+ if ('decision' !== node.kind) return;
74
+ if ('table' === node.logic.kind) counts.set(node.id, node.logic.ruleCount);
75
+ for (const child of node.children)visit(child);
76
+ };
77
+ for (const node of nodes)visit(node);
78
+ return counts;
79
+ };
80
+ const perRuleHeightOf = (heights, ruleCounts)=>{
81
+ let height = 0;
82
+ let rules = 0;
83
+ for (const [decisionId, measured] of heights){
84
+ const count = ruleCounts.get(decisionId) ?? 0;
85
+ if (0 !== count) {
86
+ height += measured;
87
+ rules += count;
88
+ }
89
+ }
90
+ return 0 === rules ? SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
91
+ };
92
+ const DecisionGraphText = ({ nodes, mode, renderBody, citations = NO_CITATIONS, expansion, onFold, onOpenDecision, rules, dataTestId })=>{
93
+ const labels = useDecisionGraphLabels();
94
+ const { selected } = mode;
95
+ const { announce, region } = useTextAnnouncements(useDecisionTextLabels(), dataTestId);
96
+ const idPrefix = useId();
97
+ const [ownExpanded, setOwnExpanded] = useState(NO_EXPANDED);
98
+ const expanded = expansion?.expanded ?? ownExpanded;
99
+ const users = useMemo(()=>usersOf(nodes), [
100
+ nodes
101
+ ]);
102
+ const drawn = useMemo(()=>new Set(decisionsOf(nodes).map(({ id })=>id)), [
103
+ nodes
104
+ ]);
105
+ const [scroller, setScroller] = useState(null);
106
+ const [launcherEnd, setLauncherEnd] = useState(0);
107
+ const cardsRef = useRef(new Map());
108
+ const [pending, setPending] = useState(null);
109
+ const [near, setNear] = useState(()=>"u" < typeof IntersectionObserver ? null : NO_EXPANDED);
110
+ const [revealed, setRevealed] = useState(null);
111
+ const [focused, setFocused] = useState(null);
112
+ const heightsRef = useRef(new Map());
113
+ const observersRef = useRef(null);
114
+ const ruleCounts = useMemo(()=>ruleCountsOf(nodes), [
115
+ nodes
116
+ ]);
117
+ const setExpanded = (next)=>{
118
+ if (expansion) expansion.onChange(next);
119
+ else setOwnExpanded(next);
120
+ };
121
+ const toggle = (decisionId)=>{
122
+ const next = new Set(expanded);
123
+ const folds = next.delete(decisionId);
124
+ if (!folds) next.add(decisionId);
125
+ setExpanded(next);
126
+ if (folds) onFold?.(decisionId);
127
+ };
128
+ const reveal = (target)=>{
129
+ if (!expanded.has(target.decisionId)) setExpanded(new Set([
130
+ ...expanded,
131
+ target.decisionId
132
+ ]));
133
+ setPending(target);
134
+ setRevealed(target.decisionId);
135
+ if ('navigate' === target.mode.kind && 'read' !== mode.kind) mode.onReveal('rule' === target.kind ? {
136
+ kind: 'rule',
137
+ decisionId: target.decisionId,
138
+ rowId: target.rowId
139
+ } : {
140
+ kind: 'decision',
141
+ decisionId: target.decisionId
142
+ });
143
+ };
144
+ const bodyContext = {
145
+ revealDecision: (decisionId, byKey)=>{
146
+ if (!drawn.has(decisionId)) return void onOpenDecision?.(decisionId);
147
+ reveal({
148
+ kind: 'decision',
149
+ decisionId,
150
+ mode: {
151
+ kind: 'navigate',
152
+ focus: byKey,
153
+ flash: true
154
+ }
155
+ });
156
+ }
157
+ };
158
+ const openOf = (decisionId)=>onOpenDecision && (()=>onOpenDecision(decisionId));
159
+ const actions = useDecisionGraphActions({
160
+ mode,
161
+ nodes,
162
+ labels,
163
+ openOf,
164
+ cardOf: (decisionId)=>cardsRef.current.get(decisionId),
165
+ scroller,
166
+ announce,
167
+ dataTestId
168
+ });
169
+ const cardRefsRef = useRef(new Map());
170
+ const cardRef = useCallback((decisionId)=>{
171
+ const cached = cardRefsRef.current.get(decisionId);
172
+ if (cached) return cached;
173
+ const attach = (element)=>{
174
+ const observers = observersRef.current;
175
+ const previous = cardsRef.current.get(decisionId);
176
+ if (previous && previous !== element) {
177
+ observers?.near.unobserve(previous);
178
+ observers?.size?.unobserve(previous);
179
+ }
180
+ if (!element) return void cardsRef.current.delete(decisionId);
181
+ cardsRef.current.set(decisionId, element);
182
+ observers?.near.observe(element);
183
+ observers?.size?.observe(element);
184
+ };
185
+ cardRefsRef.current.set(decisionId, attach);
186
+ return attach;
187
+ }, []);
188
+ useLayoutEffect(()=>{
189
+ if (!scroller || "u" < typeof IntersectionObserver) return;
190
+ const remember = (card)=>{
191
+ if (!(card instanceof HTMLElement)) return;
192
+ const decisionId = card.dataset.decisionId;
193
+ const height = bodyHeightOf(card);
194
+ if (void 0 !== decisionId && null !== height) heightsRef.current.set(decisionId, height);
195
+ };
196
+ const nearObserver = new IntersectionObserver((entries)=>{
197
+ for (const { target } of entries)remember(target);
198
+ setNear((current)=>nearAfter(current ?? NO_EXPANDED, entries));
199
+ }, {
200
+ root: scroller,
201
+ rootMargin: NEAR_MARGIN
202
+ });
203
+ const sizeObserver = "u" < typeof ResizeObserver ? null : new ResizeObserver((entries)=>{
204
+ for (const { target } of entries)remember(target);
205
+ });
206
+ observersRef.current = {
207
+ near: nearObserver,
208
+ size: sizeObserver
209
+ };
210
+ for (const card of cardsRef.current.values()){
211
+ nearObserver.observe(card);
212
+ sizeObserver?.observe(card);
213
+ }
214
+ return ()=>{
215
+ nearObserver.disconnect();
216
+ sizeObserver?.disconnect();
217
+ observersRef.current = null;
218
+ };
219
+ }, [
220
+ scroller
221
+ ]);
222
+ const perRuleHeight = perRuleHeightOf(heightsRef.current, ruleCounts);
223
+ const bodyOf = (decisionId, scrollContainer)=>{
224
+ const mounted = null === near || near.has(decisionId) || decisionId === selected || decisionId === revealed || decisionId === focused;
225
+ if (mounted) {
226
+ const body = renderBody(decisionId, bodyContext);
227
+ return 'table' === body.kind ? /*#__PURE__*/ jsx(DecisionText, {
228
+ ...body.text,
229
+ scroll: {
230
+ container: scrollContainer
231
+ },
232
+ onOpenDecision: bodyContext.revealDecision
233
+ }) : body.content;
234
+ }
235
+ const height = heightsRef.current.get(decisionId) ?? Math.max(1, ruleCounts.get(decisionId) ?? 1) * perRuleHeight;
236
+ return /*#__PURE__*/ jsx("div", {
237
+ "aria-hidden": true,
238
+ "data-graph-placeholder": true,
239
+ style: {
240
+ height
241
+ }
242
+ });
243
+ };
244
+ const onFocus = (event)=>{
245
+ const card = event.target instanceof Element ? event.target.closest('[data-graph-card]') : null;
246
+ const decisionId = card instanceof HTMLElement ? card.dataset.decisionId : void 0;
247
+ if (void 0 !== decisionId) setFocused(decisionId);
248
+ };
249
+ useLayoutEffect(()=>{
250
+ if (!pending) return;
251
+ const apply = ()=>{
252
+ const card = cardsRef.current.get(pending.decisionId);
253
+ if (!scroller || !card) return false;
254
+ if ('decision' === pending.kind) {
255
+ const heading = card.querySelector('[data-graph-toggle]');
256
+ if ('navigate' === pending.mode.kind) revealIn(scroller, {
257
+ vertical: card,
258
+ horizontal: heading ?? card,
259
+ block: 'start'
260
+ });
261
+ if (focuses(pending.mode)) heading?.focus({
262
+ preventScroll: true
263
+ });
264
+ if (flashes(pending.mode)) flash(card);
265
+ return true;
266
+ }
267
+ const rule = card.querySelector(`li[data-row-id="${CSS.escape(pending.rowId)}"]`);
268
+ if (!rule) return false;
269
+ if ('navigate' === pending.mode.kind) revealIn(scroller, {
270
+ vertical: rule,
271
+ horizontal: rule,
272
+ block: 'center'
273
+ });
274
+ if (focuses(pending.mode)) {
275
+ if (!rule.hasAttribute('tabindex')) rule.tabIndex = -1;
276
+ rule.focus({
277
+ preventScroll: true
278
+ });
279
+ }
280
+ if (flashes(pending.mode)) flash(rule);
281
+ return true;
282
+ };
283
+ if (apply()) return void setPending(null);
284
+ const frame = requestAnimationFrame(()=>{
285
+ const card = cardsRef.current.get(pending.decisionId);
286
+ if (!apply() && flashes(pending.mode) && card) flash(card);
287
+ setPending(null);
288
+ });
289
+ return ()=>cancelAnimationFrame(frame);
9
290
  });
291
+ const branch = (node, depth, position)=>{
292
+ if ('reference' === node.kind) return /*#__PURE__*/ jsx(DecisionGraphReference, {
293
+ node: node,
294
+ labels: labels,
295
+ actions: actions.referenceOf(node, position),
296
+ onReveal: ()=>reveal({
297
+ kind: 'decision',
298
+ decisionId: node.targetId,
299
+ mode: {
300
+ kind: 'navigate',
301
+ focus: false,
302
+ flash: false
303
+ }
304
+ }),
305
+ onOpen: openOf(node.targetId),
306
+ dataTestId: dataTestId
307
+ });
308
+ const open = expanded.has(node.id);
309
+ return /*#__PURE__*/ jsxs(Fragment, {
310
+ children: [
311
+ /*#__PURE__*/ jsx(DecisionGraphCard, {
312
+ node: node,
313
+ depth: depth,
314
+ open: open,
315
+ active: selected === node.id,
316
+ usedBy: (users.get(node.id) ?? []).map((user)=>user.label),
317
+ bodyId: `${idPrefix}-${encodeURIComponent(node.id)}`,
318
+ body: open && scroller ? bodyOf(node.id, scroller) : null,
319
+ labels: labels,
320
+ onToggle: ()=>toggle(node.id),
321
+ onShowProblem: (byKey)=>reveal({
322
+ ...markTargetOf(node),
323
+ mode: byKey ? {
324
+ kind: 'navigate',
325
+ focus: true,
326
+ flash: true
327
+ } : {
328
+ kind: 'inPlace'
329
+ }
330
+ }),
331
+ onOpen: openOf(node.id),
332
+ actions: actions.cardOf(node, position),
333
+ citations: citationOf(citations, node.id),
334
+ cardRef: cardRef(node.id),
335
+ dataTestId: dataTestId
336
+ }),
337
+ node.children.length > 0 && /*#__PURE__*/ jsx("div", {
338
+ className: GRAPH_NEST_CLASS,
339
+ "data-graph-nest-of": node.id,
340
+ children: childPositionsOf(node, position).map((childPosition)=>{
341
+ const child = node.children[childPosition.index];
342
+ return child && /*#__PURE__*/ jsx("div", {
343
+ className: GRAPH_BRANCH_CLASS,
344
+ children: branch(child, depth + 1, childPosition)
345
+ }, child.id);
346
+ })
347
+ })
348
+ ]
349
+ });
350
+ };
351
+ return /*#__PURE__*/ jsxs("div", {
352
+ className: cn(GRAPH_FRAME_CLASS, GRAPH_OUTPUT_HUE_CLASS),
353
+ "data-testid": dataTestId,
354
+ ...actions.focusWithin,
355
+ children: [
356
+ nodes.length > 0 && /*#__PURE__*/ jsx(DecisionGraphMinimapSlot, {
357
+ nodes: nodes,
358
+ rules: rules,
359
+ selected: selected,
360
+ onPick: (target)=>reveal({
361
+ ...target,
362
+ mode: {
363
+ kind: 'navigate',
364
+ focus: true,
365
+ flash: true
366
+ }
367
+ }),
368
+ onLauncherEnd: setLauncherEnd,
369
+ labels: labels,
370
+ dataTestId: `${dataTestId}-minimap`
371
+ }),
372
+ /*#__PURE__*/ jsxs("section", {
373
+ ref: setScroller,
374
+ "aria-label": labels.graph,
375
+ className: GRAPH_SCROLLER_CLASS,
376
+ style: {
377
+ scrollPaddingInlineStart: launcherEnd + GRAPH_MINIMAP_GAP_PX
378
+ },
379
+ "data-testid": `${dataTestId}-scroller`,
380
+ children: [
381
+ 0 === nodes.length && /*#__PURE__*/ jsx("p", {
382
+ className: GRAPH_EMPTY_CLASS,
383
+ "data-testid": `${dataTestId}-empty`,
384
+ children: labels.empty
385
+ }),
386
+ (nodes.length > 0 || actions.addTop) && /*#__PURE__*/ jsxs("div", {
387
+ className: GRAPH_COLUMN_CLASS,
388
+ style: {
389
+ paddingLeft: graphColumnInsetOf(launcherEnd)
390
+ },
391
+ onFocus: onFocus,
392
+ children: [
393
+ topPositionsOf(nodes).map((position)=>{
394
+ const node = nodes[position.index];
395
+ return node && /*#__PURE__*/ jsx("div", {
396
+ children: branch(node, 0, position)
397
+ }, node.id);
398
+ }),
399
+ actions.addTop && /*#__PURE__*/ jsxs("button", {
400
+ type: "button",
401
+ className: GRAPH_ADD_DECISION_CLASS,
402
+ onClick: actions.addTop,
403
+ "data-graph-add": true,
404
+ "data-testid": `${dataTestId}-add-decision`,
405
+ children: [
406
+ /*#__PURE__*/ jsx(Plus, {
407
+ "aria-hidden": true
408
+ }),
409
+ labels.addDecision
410
+ ]
411
+ })
412
+ ]
413
+ })
414
+ ]
415
+ }),
416
+ actions.dialogs,
417
+ region
418
+ ]
419
+ });
420
+ };
10
421
  export { DecisionGraphText };
@@ -58,6 +58,9 @@ const external_useSentenceNavigation_cjs_namespaceObject = require("./useSentenc
58
58
  const external_useTextAnnouncements_cjs_namespaceObject = require("./useTextAnnouncements.cjs");
59
59
  const external_useValueEditing_cjs_namespaceObject = require("./useValueEditing.cjs");
60
60
  const external_ValueEditorOverlay_cjs_namespaceObject = require("./ValueEditorOverlay.cjs");
61
+ const NO_CITATIONS = {
62
+ kind: 'none'
63
+ };
61
64
  const NO_FOLDS = new Set();
62
65
  const nameTokensOf = (bands)=>{
63
66
  const names = new Map(bands.flatMap(({ id, columns })=>columns.map((column)=>[
@@ -74,7 +77,7 @@ const nameTokensOf = (bands)=>{
74
77
  text: columnId
75
78
  };
76
79
  };
77
- const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false, marks = external_marks_cjs_namespaceObject.EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
80
+ const DecisionText = ({ table, mode, hitPolicies, columnTypes, citations = NO_CITATIONS, numbered = false, marks = external_marks_cjs_namespaceObject.EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
78
81
  const { rules, inputs, outputs } = table;
79
82
  const selected = 'diff' === mode.kind ? null : mode.selected;
80
83
  const onSelect = 'select' === mode.kind || 'edit' === mode.kind ? mode.onSelect : void 0;
@@ -143,6 +146,19 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
143
146
  focusedRowId
144
147
  ]);
145
148
  const ruleWindow = (0, external_useRuleWindow_cjs_namespaceObject.useRuleWindow)(listed, selected?.rowId, retainedRowIds, scroll);
149
+ const citedRows = (0, external_react_namespaceObject.useMemo)(()=>'cited' === citations.kind ? listed.flatMap((rule, index)=>{
150
+ const count = citations.rules.get(rule.rowId)?.length ?? 0;
151
+ return count > 0 ? [
152
+ {
153
+ rowId: rule.rowId,
154
+ index,
155
+ count
156
+ }
157
+ ] : [];
158
+ }) : [], [
159
+ citations,
160
+ listed
161
+ ]);
146
162
  const selectable = void 0 !== onSelect;
147
163
  const addRuleAction = (0, external_useAddRule_cjs_namespaceObject.useAddRule)({
148
164
  ...ruleWindow,
@@ -181,7 +197,15 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
181
197
  onOpenDecision,
182
198
  container: ruleWindow.container,
183
199
  stopTabbable: selectable && null !== ruleWindow.selectedRow,
184
- focusRow: setFocusedRowId
200
+ focusRow: setFocusedRowId,
201
+ history: 'edit' === mode.kind ? {
202
+ onUndo: mode.onUndo,
203
+ onRedo: mode.onRedo
204
+ } : null,
205
+ citationKeys: !selectable,
206
+ citedRows,
207
+ revealRow: ruleWindow.scrollRowIntoView,
208
+ revealStop: ruleWindow.scrollStopIntoView
185
209
  });
186
210
  const columnEditing = (0, external_useColumnEditing_cjs_namespaceObject.useColumnEditing)({
187
211
  column: 'edit' === mode.kind ? mode.edit.column : void 0,
@@ -208,6 +232,10 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
208
232
  title: title,
209
233
  hint: policyHeader.hint,
210
234
  mark: headerMark,
235
+ citations: 'cited' === citations.kind && citations.decision.length > 0 ? {
236
+ citations: citations.decision,
237
+ onOpen: citations.onOpenCitation
238
+ } : null,
211
239
  labels: labels,
212
240
  sticky: 'self' === scroll,
213
241
  dataTestId: dataTestId
@@ -256,6 +284,7 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
256
284
  selectedColumnId: navigation.selectedColumnId,
257
285
  selectable: selectable,
258
286
  decisionLinks: void 0 !== onOpenDecision,
287
+ citations: citations,
259
288
  style: listStyle,
260
289
  idPrefix: idPrefix,
261
290
  dataTestId: dataTestId,
@@ -5,9 +5,9 @@ import { type DecisionTextDiff } from './decisionTextDiff';
5
5
  import type { DecisionTextEdit } from './decisionTextTypes';
6
6
  import { type HitPolicyCatalog, type HitPolicyPick } from './hitPolicyMenu';
7
7
  import { type TableMarks } from './marks';
8
- import type { DecisionTextTable, SentenceSelection } from './sentenceTypes';
8
+ import type { DecisionTextCitations, DecisionTextTable, SentenceSelection } from './sentenceTypes';
9
9
  import { useCellHover } from './useCellHover';
10
- import { type ContainerHandlersParams, type DecisionTextContainerProps } from './useContainerHandlers';
10
+ import { type ContainerHandlersParams, type DecisionTextContainerProps, type TextHistory } from './useContainerHandlers';
11
11
  import { type DecisionTextScroll } from './useRuleWindow';
12
12
  import { type SentenceNavigationSource } from './useSentenceNavigation';
13
13
  type SelectHandler = NonNullable<SentenceNavigationSource['onSelect']>;
@@ -18,14 +18,14 @@ export type DecisionTextMode<Op, Policy, Total, Type, Refusal> = {
18
18
  kind: 'select';
19
19
  selected: SentenceSelection | null;
20
20
  onSelect: SelectHandler;
21
- } | {
21
+ } | (TextHistory & {
22
22
  kind: 'edit';
23
23
  selected: SentenceSelection | null;
24
24
  onSelect: SelectHandler;
25
25
  edit: DecisionTextEdit<Op, Type, Refusal>;
26
26
  onPolicyChange: (picked: HitPolicyPick<Policy, Total>) => void;
27
27
  onAddRule: () => void;
28
- } | {
28
+ }) | {
29
29
  kind: 'diff';
30
30
  diff: DecisionTextDiff<Policy, Total, Type>;
31
31
  };
@@ -34,6 +34,7 @@ export interface DecisionTextProps<Op, Policy, Total, Type, Refusal> {
34
34
  mode: DecisionTextMode<Op, Policy, Total, Type, Refusal>;
35
35
  hitPolicies: HitPolicyCatalog<Policy, Total>;
36
36
  columnTypes: readonly ColumnTypeOption<Type>[];
37
+ citations?: DecisionTextCitations;
37
38
  numbered?: boolean;
38
39
  marks?: TableMarks;
39
40
  onCellHover?: Parameters<typeof useCellHover>[0];
@@ -45,6 +46,6 @@ export interface DecisionTextProps<Op, Policy, Total, Type, Refusal> {
45
46
  dataTestId: string;
46
47
  children?: React.ReactNode;
47
48
  }
48
- export declare const DecisionText: <Op, Policy, Total, Type, Refusal>({ table, mode, hitPolicies, columnTypes, numbered, marks, onCellHover, headerMark, onOpenDecision, scroll, ariaLabel, containerProps, dataTestId, children, }: DecisionTextProps<Op, Policy, Total, Type, Refusal>) => React.JSX.Element;
49
+ export declare const DecisionText: <Op, Policy, Total, Type, Refusal>({ table, mode, hitPolicies, columnTypes, citations, numbered, marks, onCellHover, headerMark, onOpenDecision, scroll, ariaLabel, containerProps, dataTestId, children, }: DecisionTextProps<Op, Policy, Total, Type, Refusal>) => React.JSX.Element;
49
50
  export {};
50
51
  //# sourceMappingURL=DecisionText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DecisionText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,KAAK,gBAAgB,EAAW,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,KAAK,gBAAgB,EAA6B,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAGnB,MAAM,iBAAi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E,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,0KAgB5D,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,KAAG,KAAK,CAAC,GAAG,CAAC,OA2OlE,CAAC"}
@@ -30,6 +30,9 @@ import { useSentenceNavigation } from "./useSentenceNavigation.js";
30
30
  import { useTextAnnouncements } from "./useTextAnnouncements.js";
31
31
  import { useValueEditing } from "./useValueEditing.js";
32
32
  import { ValueEditorOverlay } from "./ValueEditorOverlay.js";
33
+ const NO_CITATIONS = {
34
+ kind: 'none'
35
+ };
33
36
  const NO_FOLDS = new Set();
34
37
  const nameTokensOf = (bands)=>{
35
38
  const names = new Map(bands.flatMap(({ id, columns })=>columns.map((column)=>[
@@ -46,7 +49,7 @@ const nameTokensOf = (bands)=>{
46
49
  text: columnId
47
50
  };
48
51
  };
49
- const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false, marks = EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
52
+ const DecisionText = ({ table, mode, hitPolicies, columnTypes, citations = NO_CITATIONS, numbered = false, marks = EMPTY_MARKS, onCellHover, headerMark, onOpenDecision, scroll = 'self', ariaLabel, containerProps, dataTestId, children })=>{
50
53
  const { rules, inputs, outputs } = table;
51
54
  const selected = 'diff' === mode.kind ? null : mode.selected;
52
55
  const onSelect = 'select' === mode.kind || 'edit' === mode.kind ? mode.onSelect : void 0;
@@ -115,6 +118,19 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
115
118
  focusedRowId
116
119
  ]);
117
120
  const ruleWindow = useRuleWindow(listed, selected?.rowId, retainedRowIds, scroll);
121
+ const citedRows = useMemo(()=>'cited' === citations.kind ? listed.flatMap((rule, index)=>{
122
+ const count = citations.rules.get(rule.rowId)?.length ?? 0;
123
+ return count > 0 ? [
124
+ {
125
+ rowId: rule.rowId,
126
+ index,
127
+ count
128
+ }
129
+ ] : [];
130
+ }) : [], [
131
+ citations,
132
+ listed
133
+ ]);
118
134
  const selectable = void 0 !== onSelect;
119
135
  const addRuleAction = useAddRule({
120
136
  ...ruleWindow,
@@ -153,7 +169,15 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
153
169
  onOpenDecision,
154
170
  container: ruleWindow.container,
155
171
  stopTabbable: selectable && null !== ruleWindow.selectedRow,
156
- focusRow: setFocusedRowId
172
+ focusRow: setFocusedRowId,
173
+ history: 'edit' === mode.kind ? {
174
+ onUndo: mode.onUndo,
175
+ onRedo: mode.onRedo
176
+ } : null,
177
+ citationKeys: !selectable,
178
+ citedRows,
179
+ revealRow: ruleWindow.scrollRowIntoView,
180
+ revealStop: ruleWindow.scrollStopIntoView
157
181
  });
158
182
  const columnEditing = useColumnEditing({
159
183
  column: 'edit' === mode.kind ? mode.edit.column : void 0,
@@ -180,6 +204,10 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
180
204
  title: title,
181
205
  hint: policyHeader.hint,
182
206
  mark: headerMark,
207
+ citations: 'cited' === citations.kind && citations.decision.length > 0 ? {
208
+ citations: citations.decision,
209
+ onOpen: citations.onOpenCitation
210
+ } : null,
183
211
  labels: labels,
184
212
  sticky: 'self' === scroll,
185
213
  dataTestId: dataTestId
@@ -228,6 +256,7 @@ const DecisionText = ({ table, mode, hitPolicies, columnTypes, numbered = false,
228
256
  selectedColumnId: navigation.selectedColumnId,
229
257
  selectable: selectable,
230
258
  decisionLinks: void 0 !== onOpenDecision,
259
+ citations: citations,
231
260
  style: listStyle,
232
261
  idPrefix: idPrefix,
233
262
  dataTestId: dataTestId,
@@ -29,6 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
31
31
  const external_react_namespaceObject = require("react");
32
+ const external_CitationButton_cjs_namespaceObject = require("./CitationButton.cjs");
32
33
  const external_MarkBadge_cjs_namespaceObject = require("./MarkBadge.cjs");
33
34
  const external_PolicyPicker_cjs_namespaceObject = require("./PolicyPicker.cjs");
34
35
  const external_sentenceMarks_cjs_namespaceObject = require("./sentenceMarks.cjs");
@@ -70,7 +71,7 @@ const HitPolicyChange = ({ change, describedBy, labels })=>/*#__PURE__*/ (0, jsx
70
71
  })
71
72
  ]
72
73
  });
73
- const DecisionTextHeader = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ title, hint, mark, labels, sticky, dataTestId }, ref)=>{
74
+ const DecisionTextHeader = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ title, hint, mark, citations, labels, sticky, dataTestId }, ref)=>{
74
75
  const badgeId = (0, external_react_namespaceObject.useId)();
75
76
  const marks = (0, external_sentenceMarks_cjs_namespaceObject.isLineMark)(mark) ? [
76
77
  mark
@@ -103,6 +104,21 @@ const DecisionTextHeader = /*#__PURE__*/ (0, external_react_namespaceObject.forw
103
104
  }),
104
105
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
105
106
  children: hint
107
+ }),
108
+ citations && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
109
+ className: external_sentenceStyles_cjs_namespaceObject.HEADER_CITATIONS_CLASS,
110
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CitationButton_cjs_namespaceObject.CitationButtons, {
111
+ citations: citations.citations,
112
+ owner: {
113
+ kind: 'table'
114
+ },
115
+ onOpen: citations.onOpen,
116
+ selected: true,
117
+ tabIndex: 0,
118
+ className: external_sentenceStyles_cjs_namespaceObject.HEADER_CITATION_REVEAL_CLASS,
119
+ labels: labels,
120
+ dataTestId: `${dataTestId}-citation`
121
+ })
106
122
  })
107
123
  ]
108
124
  });