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