@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.
- package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +4 -4
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +4 -4
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/CitationButton.cjs +72 -0
- package/dist/decision-table/CitationButton.d.ts +33 -0
- package/dist/decision-table/CitationButton.d.ts.map +1 -0
- package/dist/decision-table/CitationButton.js +35 -0
- package/dist/decision-table/DecisionGraphCard.cjs +16 -2
- package/dist/decision-table/DecisionGraphCard.d.ts +5 -0
- package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphCard.js +17 -3
- package/dist/decision-table/DecisionGraphText.cjs +417 -6
- package/dist/decision-table/DecisionGraphText.d.ts +22 -4
- package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
- package/dist/decision-table/DecisionGraphText.js +418 -7
- package/dist/decision-table/DecisionText.cjs +31 -2
- package/dist/decision-table/DecisionText.d.ts +6 -5
- package/dist/decision-table/DecisionText.d.ts.map +1 -1
- package/dist/decision-table/DecisionText.js +31 -2
- package/dist/decision-table/DecisionTextHeader.cjs +17 -1
- package/dist/decision-table/DecisionTextHeader.d.ts +7 -1
- package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -1
- package/dist/decision-table/DecisionTextHeader.js +18 -2
- package/dist/decision-table/RuleCard.cjs +60 -26
- package/dist/decision-table/RuleCard.d.ts +2 -0
- package/dist/decision-table/RuleCard.d.ts.map +1 -1
- package/dist/decision-table/RuleCard.js +61 -27
- package/dist/decision-table/RuleList.cjs +2 -1
- package/dist/decision-table/RuleList.d.ts +1 -0
- package/dist/decision-table/RuleList.d.ts.map +1 -1
- package/dist/decision-table/RuleList.js +2 -1
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts +4 -2
- package/dist/decision-table/__fixtures__/storyTableHost.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/textMode.d.ts +6 -3
- package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
- package/dist/decision-table/__fixtures__/useStoryHistory.d.ts +7 -0
- package/dist/decision-table/__fixtures__/useStoryHistory.d.ts.map +1 -0
- package/dist/decision-table/decisionGraphActionTypes.d.ts +8 -0
- package/dist/decision-table/decisionGraphActionTypes.d.ts.map +1 -1
- package/dist/decision-table/decisionGraphTypes.d.ts +8 -0
- package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +56 -56
- package/dist/decision-table/index.d.ts +4 -4
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +2 -2
- package/dist/decision-table/locales/de.cjs +1 -1
- package/dist/decision-table/locales/de.d.ts.map +1 -1
- package/dist/decision-table/locales/de.js +1 -1
- package/dist/decision-table/locales/en.cjs +1 -1
- package/dist/decision-table/locales/en.d.ts.map +1 -1
- package/dist/decision-table/locales/en.js +1 -1
- package/dist/decision-table/locales/es-MX.cjs +1 -1
- package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
- package/dist/decision-table/locales/es-MX.js +1 -1
- package/dist/decision-table/locales/es.cjs +1 -1
- package/dist/decision-table/locales/es.d.ts.map +1 -1
- package/dist/decision-table/locales/es.js +1 -1
- package/dist/decision-table/locales/fr.cjs +1 -1
- package/dist/decision-table/locales/fr.d.ts.map +1 -1
- package/dist/decision-table/locales/fr.js +1 -1
- package/dist/decision-table/locales/ja.cjs +1 -1
- package/dist/decision-table/locales/ja.d.ts.map +1 -1
- package/dist/decision-table/locales/ja.js +1 -1
- package/dist/decision-table/locales/ko.cjs +1 -1
- package/dist/decision-table/locales/ko.d.ts.map +1 -1
- package/dist/decision-table/locales/ko.js +1 -1
- package/dist/decision-table/locales/pt-BR.cjs +1 -1
- package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
- package/dist/decision-table/locales/pt-BR.js +1 -1
- package/dist/decision-table/locales/pt.cjs +1 -1
- package/dist/decision-table/locales/pt.d.ts.map +1 -1
- package/dist/decision-table/locales/pt.js +1 -1
- package/dist/decision-table/locales/ro.cjs +1 -1
- package/dist/decision-table/locales/ro.d.ts.map +1 -1
- package/dist/decision-table/locales/ro.js +1 -1
- package/dist/decision-table/locales/ru.cjs +1 -1
- package/dist/decision-table/locales/ru.d.ts.map +1 -1
- package/dist/decision-table/locales/ru.js +1 -1
- package/dist/decision-table/locales/tr.cjs +1 -1
- package/dist/decision-table/locales/tr.d.ts.map +1 -1
- package/dist/decision-table/locales/tr.js +1 -1
- package/dist/decision-table/locales/zh-CN.cjs +1 -1
- package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
- package/dist/decision-table/locales/zh-CN.js +1 -1
- package/dist/decision-table/locales/zh-TW.cjs +1 -1
- package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
- package/dist/decision-table/locales/zh-TW.js +1 -1
- package/dist/decision-table/ruleCardModel.d.ts +2 -1
- package/dist/decision-table/ruleCardModel.d.ts.map +1 -1
- package/dist/decision-table/sentenceSelection.cjs +15 -1
- package/dist/decision-table/sentenceSelection.d.ts +3 -1
- package/dist/decision-table/sentenceSelection.d.ts.map +1 -1
- package/dist/decision-table/sentenceSelection.js +9 -1
- package/dist/decision-table/sentenceStyles.cjs +33 -6
- package/dist/decision-table/sentenceStyles.d.ts +8 -1
- package/dist/decision-table/sentenceStyles.d.ts.map +1 -1
- package/dist/decision-table/sentenceStyles.js +9 -3
- package/dist/decision-table/sentenceTypes.d.ts +28 -0
- package/dist/decision-table/sentenceTypes.d.ts.map +1 -1
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useContainerHandlers.cjs +99 -3
- package/dist/decision-table/useContainerHandlers.d.ts +15 -1
- package/dist/decision-table/useContainerHandlers.d.ts.map +1 -1
- package/dist/decision-table/useContainerHandlers.js +100 -4
- package/dist/decision-table/useDecisionGraphStrings.cjs +6 -2
- package/dist/decision-table/useDecisionGraphStrings.d.ts +2 -1
- package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionGraphStrings.js +6 -2
- package/dist/decision-table/useDecisionTextStrings.cjs +36 -0
- package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
- package/dist/decision-table/useDecisionTextStrings.js +36 -0
- package/dist/decision-table/useSentenceNavigation.cjs +5 -6
- package/dist/decision-table/useSentenceNavigation.d.ts.map +1 -1
- package/dist/decision-table/useSentenceNavigation.js +1 -2
- package/package.json +2 -2
- package/dist/decision-table/DecisionGraphView.cjs +0 -435
- package/dist/decision-table/DecisionGraphView.d.ts +0 -19
- package/dist/decision-table/DecisionGraphView.d.ts.map +0 -1
- package/dist/decision-table/DecisionGraphView.js +0 -401
- package/dist/decision-table/EditableDecisionGraphText.cjs +0 -40
- package/dist/decision-table/EditableDecisionGraphText.d.ts +0 -5
- package/dist/decision-table/EditableDecisionGraphText.d.ts.map +0 -1
- package/dist/decision-table/EditableDecisionGraphText.js +0 -6
|
@@ -27,14 +27,425 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
DecisionGraphText: ()=>DecisionGraphText
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const external_DecisionGraphCard_cjs_namespaceObject = require("./DecisionGraphCard.cjs");
|
|
34
|
+
const external_DecisionGraphMinimapSlot_cjs_namespaceObject = require("./DecisionGraphMinimapSlot.cjs");
|
|
35
|
+
const external_DecisionText_cjs_namespaceObject = require("./DecisionText.cjs");
|
|
36
|
+
const external_decisionGraphPositions_cjs_namespaceObject = require("./decisionGraphPositions.cjs");
|
|
37
|
+
const external_decisionGraphStyles_cjs_namespaceObject = require("./decisionGraphStyles.cjs");
|
|
38
|
+
const external_revealIn_cjs_namespaceObject = require("./revealIn.cjs");
|
|
39
|
+
const external_sentenceRuleHeights_cjs_namespaceObject = require("./sentenceRuleHeights.cjs");
|
|
40
|
+
const external_useDecisionGraphActions_cjs_namespaceObject = require("./useDecisionGraphActions.cjs");
|
|
41
|
+
const external_useDecisionGraphStrings_cjs_namespaceObject = require("./useDecisionGraphStrings.cjs");
|
|
42
|
+
const external_useDecisionTextStrings_cjs_namespaceObject = require("./useDecisionTextStrings.cjs");
|
|
43
|
+
const external_useTextAnnouncements_cjs_namespaceObject = require("./useTextAnnouncements.cjs");
|
|
44
|
+
const NO_CITATIONS = {
|
|
45
|
+
kind: 'none'
|
|
33
46
|
};
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
const NO_EXPANDED = new Set();
|
|
48
|
+
const markTargetOf = ({ id, mark })=>mark?.kind === 'rule' ? {
|
|
49
|
+
kind: 'rule',
|
|
50
|
+
decisionId: id,
|
|
51
|
+
rowId: mark.rowId
|
|
52
|
+
} : {
|
|
53
|
+
kind: 'decision',
|
|
54
|
+
decisionId: id
|
|
55
|
+
};
|
|
56
|
+
const citationOf = (citations, decisionId)=>{
|
|
57
|
+
const cited = 'cited' === citations.kind ? citations.decisions.get(decisionId) ?? [] : [];
|
|
58
|
+
return 'cited' === citations.kind && cited.length > 0 ? {
|
|
59
|
+
citations: cited,
|
|
60
|
+
onOpen: citations.onOpenCitation
|
|
61
|
+
} : null;
|
|
62
|
+
};
|
|
63
|
+
const focuses = (mode)=>'navigate' === mode.kind && mode.focus;
|
|
64
|
+
const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
|
|
65
|
+
const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
66
|
+
const flash = (element)=>{
|
|
67
|
+
if (prefersReducedMotion()) return;
|
|
68
|
+
element.animate?.([
|
|
69
|
+
{
|
|
70
|
+
boxShadow: '0 0 0 4px color-mix(in srgb, var(--color-primary) 40%, transparent)'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
boxShadow: '0 0 0 0 transparent'
|
|
74
|
+
}
|
|
75
|
+
], {
|
|
76
|
+
duration: 1400,
|
|
77
|
+
easing: 'ease-out'
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const NEAR_MARGIN = '100% 0px';
|
|
81
|
+
const nearAfter = (current, entries)=>{
|
|
82
|
+
let next;
|
|
83
|
+
for (const { target, isIntersecting } of entries){
|
|
84
|
+
const decisionId = target instanceof HTMLElement ? target.dataset.decisionId : void 0;
|
|
85
|
+
if (void 0 !== decisionId && (next ?? current).has(decisionId) !== isIntersecting) {
|
|
86
|
+
next ??= new Set(current);
|
|
87
|
+
if (isIntersecting) next.add(decisionId);
|
|
88
|
+
else next.delete(decisionId);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return next ?? current;
|
|
92
|
+
};
|
|
93
|
+
const bodyHeightOf = (card)=>{
|
|
94
|
+
const body = card.querySelector(':scope > [data-graph-body]');
|
|
95
|
+
if (!body || body.querySelector(':scope > [data-graph-placeholder]')) return null;
|
|
96
|
+
return body.offsetHeight || null;
|
|
97
|
+
};
|
|
98
|
+
const ruleCountsOf = (nodes)=>{
|
|
99
|
+
const counts = new Map();
|
|
100
|
+
const visit = (node)=>{
|
|
101
|
+
if ('decision' !== node.kind) return;
|
|
102
|
+
if ('table' === node.logic.kind) counts.set(node.id, node.logic.ruleCount);
|
|
103
|
+
for (const child of node.children)visit(child);
|
|
104
|
+
};
|
|
105
|
+
for (const node of nodes)visit(node);
|
|
106
|
+
return counts;
|
|
107
|
+
};
|
|
108
|
+
const perRuleHeightOf = (heights, ruleCounts)=>{
|
|
109
|
+
let height = 0;
|
|
110
|
+
let rules = 0;
|
|
111
|
+
for (const [decisionId, measured] of heights){
|
|
112
|
+
const count = ruleCounts.get(decisionId) ?? 0;
|
|
113
|
+
if (0 !== count) {
|
|
114
|
+
height += measured;
|
|
115
|
+
rules += count;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return 0 === rules ? external_sentenceRuleHeights_cjs_namespaceObject.SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
|
|
119
|
+
};
|
|
120
|
+
const DecisionGraphText = ({ nodes, mode, renderBody, citations = NO_CITATIONS, expansion, onFold, onOpenDecision, rules, dataTestId })=>{
|
|
121
|
+
const labels = (0, external_useDecisionGraphStrings_cjs_namespaceObject.useDecisionGraphLabels)();
|
|
122
|
+
const { selected } = mode;
|
|
123
|
+
const { announce, region } = (0, external_useTextAnnouncements_cjs_namespaceObject.useTextAnnouncements)((0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)(), dataTestId);
|
|
124
|
+
const idPrefix = (0, external_react_namespaceObject.useId)();
|
|
125
|
+
const [ownExpanded, setOwnExpanded] = (0, external_react_namespaceObject.useState)(NO_EXPANDED);
|
|
126
|
+
const expanded = expansion?.expanded ?? ownExpanded;
|
|
127
|
+
const users = (0, external_react_namespaceObject.useMemo)(()=>(0, external_decisionGraphPositions_cjs_namespaceObject.usersOf)(nodes), [
|
|
128
|
+
nodes
|
|
129
|
+
]);
|
|
130
|
+
const drawn = (0, external_react_namespaceObject.useMemo)(()=>new Set((0, external_decisionGraphPositions_cjs_namespaceObject.decisionsOf)(nodes).map(({ id })=>id)), [
|
|
131
|
+
nodes
|
|
132
|
+
]);
|
|
133
|
+
const [scroller, setScroller] = (0, external_react_namespaceObject.useState)(null);
|
|
134
|
+
const [launcherEnd, setLauncherEnd] = (0, external_react_namespaceObject.useState)(0);
|
|
135
|
+
const cardsRef = (0, external_react_namespaceObject.useRef)(new Map());
|
|
136
|
+
const [pending, setPending] = (0, external_react_namespaceObject.useState)(null);
|
|
137
|
+
const [near, setNear] = (0, external_react_namespaceObject.useState)(()=>"u" < typeof IntersectionObserver ? null : NO_EXPANDED);
|
|
138
|
+
const [revealed, setRevealed] = (0, external_react_namespaceObject.useState)(null);
|
|
139
|
+
const [focused, setFocused] = (0, external_react_namespaceObject.useState)(null);
|
|
140
|
+
const heightsRef = (0, external_react_namespaceObject.useRef)(new Map());
|
|
141
|
+
const observersRef = (0, external_react_namespaceObject.useRef)(null);
|
|
142
|
+
const ruleCounts = (0, external_react_namespaceObject.useMemo)(()=>ruleCountsOf(nodes), [
|
|
143
|
+
nodes
|
|
144
|
+
]);
|
|
145
|
+
const setExpanded = (next)=>{
|
|
146
|
+
if (expansion) expansion.onChange(next);
|
|
147
|
+
else setOwnExpanded(next);
|
|
148
|
+
};
|
|
149
|
+
const toggle = (decisionId)=>{
|
|
150
|
+
const next = new Set(expanded);
|
|
151
|
+
const folds = next.delete(decisionId);
|
|
152
|
+
if (!folds) next.add(decisionId);
|
|
153
|
+
setExpanded(next);
|
|
154
|
+
if (folds) onFold?.(decisionId);
|
|
155
|
+
};
|
|
156
|
+
const reveal = (target)=>{
|
|
157
|
+
if (!expanded.has(target.decisionId)) setExpanded(new Set([
|
|
158
|
+
...expanded,
|
|
159
|
+
target.decisionId
|
|
160
|
+
]));
|
|
161
|
+
setPending(target);
|
|
162
|
+
setRevealed(target.decisionId);
|
|
163
|
+
if ('navigate' === target.mode.kind && 'read' !== mode.kind) mode.onReveal('rule' === target.kind ? {
|
|
164
|
+
kind: 'rule',
|
|
165
|
+
decisionId: target.decisionId,
|
|
166
|
+
rowId: target.rowId
|
|
167
|
+
} : {
|
|
168
|
+
kind: 'decision',
|
|
169
|
+
decisionId: target.decisionId
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
const bodyContext = {
|
|
173
|
+
revealDecision: (decisionId, byKey)=>{
|
|
174
|
+
if (!drawn.has(decisionId)) return void onOpenDecision?.(decisionId);
|
|
175
|
+
reveal({
|
|
176
|
+
kind: 'decision',
|
|
177
|
+
decisionId,
|
|
178
|
+
mode: {
|
|
179
|
+
kind: 'navigate',
|
|
180
|
+
focus: byKey,
|
|
181
|
+
flash: true
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const openOf = (decisionId)=>onOpenDecision && (()=>onOpenDecision(decisionId));
|
|
187
|
+
const actions = (0, external_useDecisionGraphActions_cjs_namespaceObject.useDecisionGraphActions)({
|
|
188
|
+
mode,
|
|
189
|
+
nodes,
|
|
190
|
+
labels,
|
|
191
|
+
openOf,
|
|
192
|
+
cardOf: (decisionId)=>cardsRef.current.get(decisionId),
|
|
193
|
+
scroller,
|
|
194
|
+
announce,
|
|
195
|
+
dataTestId
|
|
37
196
|
});
|
|
197
|
+
const cardRefsRef = (0, external_react_namespaceObject.useRef)(new Map());
|
|
198
|
+
const cardRef = (0, external_react_namespaceObject.useCallback)((decisionId)=>{
|
|
199
|
+
const cached = cardRefsRef.current.get(decisionId);
|
|
200
|
+
if (cached) return cached;
|
|
201
|
+
const attach = (element)=>{
|
|
202
|
+
const observers = observersRef.current;
|
|
203
|
+
const previous = cardsRef.current.get(decisionId);
|
|
204
|
+
if (previous && previous !== element) {
|
|
205
|
+
observers?.near.unobserve(previous);
|
|
206
|
+
observers?.size?.unobserve(previous);
|
|
207
|
+
}
|
|
208
|
+
if (!element) return void cardsRef.current.delete(decisionId);
|
|
209
|
+
cardsRef.current.set(decisionId, element);
|
|
210
|
+
observers?.near.observe(element);
|
|
211
|
+
observers?.size?.observe(element);
|
|
212
|
+
};
|
|
213
|
+
cardRefsRef.current.set(decisionId, attach);
|
|
214
|
+
return attach;
|
|
215
|
+
}, []);
|
|
216
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
217
|
+
if (!scroller || "u" < typeof IntersectionObserver) return;
|
|
218
|
+
const remember = (card)=>{
|
|
219
|
+
if (!(card instanceof HTMLElement)) return;
|
|
220
|
+
const decisionId = card.dataset.decisionId;
|
|
221
|
+
const height = bodyHeightOf(card);
|
|
222
|
+
if (void 0 !== decisionId && null !== height) heightsRef.current.set(decisionId, height);
|
|
223
|
+
};
|
|
224
|
+
const nearObserver = new IntersectionObserver((entries)=>{
|
|
225
|
+
for (const { target } of entries)remember(target);
|
|
226
|
+
setNear((current)=>nearAfter(current ?? NO_EXPANDED, entries));
|
|
227
|
+
}, {
|
|
228
|
+
root: scroller,
|
|
229
|
+
rootMargin: NEAR_MARGIN
|
|
230
|
+
});
|
|
231
|
+
const sizeObserver = "u" < typeof ResizeObserver ? null : new ResizeObserver((entries)=>{
|
|
232
|
+
for (const { target } of entries)remember(target);
|
|
233
|
+
});
|
|
234
|
+
observersRef.current = {
|
|
235
|
+
near: nearObserver,
|
|
236
|
+
size: sizeObserver
|
|
237
|
+
};
|
|
238
|
+
for (const card of cardsRef.current.values()){
|
|
239
|
+
nearObserver.observe(card);
|
|
240
|
+
sizeObserver?.observe(card);
|
|
241
|
+
}
|
|
242
|
+
return ()=>{
|
|
243
|
+
nearObserver.disconnect();
|
|
244
|
+
sizeObserver?.disconnect();
|
|
245
|
+
observersRef.current = null;
|
|
246
|
+
};
|
|
247
|
+
}, [
|
|
248
|
+
scroller
|
|
249
|
+
]);
|
|
250
|
+
const perRuleHeight = perRuleHeightOf(heightsRef.current, ruleCounts);
|
|
251
|
+
const bodyOf = (decisionId, scrollContainer)=>{
|
|
252
|
+
const mounted = null === near || near.has(decisionId) || decisionId === selected || decisionId === revealed || decisionId === focused;
|
|
253
|
+
if (mounted) {
|
|
254
|
+
const body = renderBody(decisionId, bodyContext);
|
|
255
|
+
return 'table' === body.kind ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionText_cjs_namespaceObject.DecisionText, {
|
|
256
|
+
...body.text,
|
|
257
|
+
scroll: {
|
|
258
|
+
container: scrollContainer
|
|
259
|
+
},
|
|
260
|
+
onOpenDecision: bodyContext.revealDecision
|
|
261
|
+
}) : body.content;
|
|
262
|
+
}
|
|
263
|
+
const height = heightsRef.current.get(decisionId) ?? Math.max(1, ruleCounts.get(decisionId) ?? 1) * perRuleHeight;
|
|
264
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
265
|
+
"aria-hidden": true,
|
|
266
|
+
"data-graph-placeholder": true,
|
|
267
|
+
style: {
|
|
268
|
+
height
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
const onFocus = (event)=>{
|
|
273
|
+
const card = event.target instanceof Element ? event.target.closest('[data-graph-card]') : null;
|
|
274
|
+
const decisionId = card instanceof HTMLElement ? card.dataset.decisionId : void 0;
|
|
275
|
+
if (void 0 !== decisionId) setFocused(decisionId);
|
|
276
|
+
};
|
|
277
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
278
|
+
if (!pending) return;
|
|
279
|
+
const apply = ()=>{
|
|
280
|
+
const card = cardsRef.current.get(pending.decisionId);
|
|
281
|
+
if (!scroller || !card) return false;
|
|
282
|
+
if ('decision' === pending.kind) {
|
|
283
|
+
const heading = card.querySelector('[data-graph-toggle]');
|
|
284
|
+
if ('navigate' === pending.mode.kind) (0, external_revealIn_cjs_namespaceObject.revealIn)(scroller, {
|
|
285
|
+
vertical: card,
|
|
286
|
+
horizontal: heading ?? card,
|
|
287
|
+
block: 'start'
|
|
288
|
+
});
|
|
289
|
+
if (focuses(pending.mode)) heading?.focus({
|
|
290
|
+
preventScroll: true
|
|
291
|
+
});
|
|
292
|
+
if (flashes(pending.mode)) flash(card);
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
const rule = card.querySelector(`li[data-row-id="${CSS.escape(pending.rowId)}"]`);
|
|
296
|
+
if (!rule) return false;
|
|
297
|
+
if ('navigate' === pending.mode.kind) (0, external_revealIn_cjs_namespaceObject.revealIn)(scroller, {
|
|
298
|
+
vertical: rule,
|
|
299
|
+
horizontal: rule,
|
|
300
|
+
block: 'center'
|
|
301
|
+
});
|
|
302
|
+
if (focuses(pending.mode)) {
|
|
303
|
+
if (!rule.hasAttribute('tabindex')) rule.tabIndex = -1;
|
|
304
|
+
rule.focus({
|
|
305
|
+
preventScroll: true
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
if (flashes(pending.mode)) flash(rule);
|
|
309
|
+
return true;
|
|
310
|
+
};
|
|
311
|
+
if (apply()) return void setPending(null);
|
|
312
|
+
const frame = requestAnimationFrame(()=>{
|
|
313
|
+
const card = cardsRef.current.get(pending.decisionId);
|
|
314
|
+
if (!apply() && flashes(pending.mode) && card) flash(card);
|
|
315
|
+
setPending(null);
|
|
316
|
+
});
|
|
317
|
+
return ()=>cancelAnimationFrame(frame);
|
|
318
|
+
});
|
|
319
|
+
const branch = (node, depth, position)=>{
|
|
320
|
+
if ('reference' === node.kind) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionGraphCard_cjs_namespaceObject.DecisionGraphReference, {
|
|
321
|
+
node: node,
|
|
322
|
+
labels: labels,
|
|
323
|
+
actions: actions.referenceOf(node, position),
|
|
324
|
+
onReveal: ()=>reveal({
|
|
325
|
+
kind: 'decision',
|
|
326
|
+
decisionId: node.targetId,
|
|
327
|
+
mode: {
|
|
328
|
+
kind: 'navigate',
|
|
329
|
+
focus: false,
|
|
330
|
+
flash: false
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
onOpen: openOf(node.targetId),
|
|
334
|
+
dataTestId: dataTestId
|
|
335
|
+
});
|
|
336
|
+
const open = expanded.has(node.id);
|
|
337
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
338
|
+
children: [
|
|
339
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionGraphCard_cjs_namespaceObject.DecisionGraphCard, {
|
|
340
|
+
node: node,
|
|
341
|
+
depth: depth,
|
|
342
|
+
open: open,
|
|
343
|
+
active: selected === node.id,
|
|
344
|
+
usedBy: (users.get(node.id) ?? []).map((user)=>user.label),
|
|
345
|
+
bodyId: `${idPrefix}-${encodeURIComponent(node.id)}`,
|
|
346
|
+
body: open && scroller ? bodyOf(node.id, scroller) : null,
|
|
347
|
+
labels: labels,
|
|
348
|
+
onToggle: ()=>toggle(node.id),
|
|
349
|
+
onShowProblem: (byKey)=>reveal({
|
|
350
|
+
...markTargetOf(node),
|
|
351
|
+
mode: byKey ? {
|
|
352
|
+
kind: 'navigate',
|
|
353
|
+
focus: true,
|
|
354
|
+
flash: true
|
|
355
|
+
} : {
|
|
356
|
+
kind: 'inPlace'
|
|
357
|
+
}
|
|
358
|
+
}),
|
|
359
|
+
onOpen: openOf(node.id),
|
|
360
|
+
actions: actions.cardOf(node, position),
|
|
361
|
+
citations: citationOf(citations, node.id),
|
|
362
|
+
cardRef: cardRef(node.id),
|
|
363
|
+
dataTestId: dataTestId
|
|
364
|
+
}),
|
|
365
|
+
node.children.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
366
|
+
className: external_decisionGraphStyles_cjs_namespaceObject.GRAPH_NEST_CLASS,
|
|
367
|
+
"data-graph-nest-of": node.id,
|
|
368
|
+
children: (0, external_decisionGraphPositions_cjs_namespaceObject.childPositionsOf)(node, position).map((childPosition)=>{
|
|
369
|
+
const child = node.children[childPosition.index];
|
|
370
|
+
return child && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
371
|
+
className: external_decisionGraphStyles_cjs_namespaceObject.GRAPH_BRANCH_CLASS,
|
|
372
|
+
children: branch(child, depth + 1, childPosition)
|
|
373
|
+
}, child.id);
|
|
374
|
+
})
|
|
375
|
+
})
|
|
376
|
+
]
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
380
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_decisionGraphStyles_cjs_namespaceObject.GRAPH_FRAME_CLASS, external_decisionGraphStyles_cjs_namespaceObject.GRAPH_OUTPUT_HUE_CLASS),
|
|
381
|
+
"data-testid": dataTestId,
|
|
382
|
+
...actions.focusWithin,
|
|
383
|
+
children: [
|
|
384
|
+
nodes.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionGraphMinimapSlot_cjs_namespaceObject.DecisionGraphMinimapSlot, {
|
|
385
|
+
nodes: nodes,
|
|
386
|
+
rules: rules,
|
|
387
|
+
selected: selected,
|
|
388
|
+
onPick: (target)=>reveal({
|
|
389
|
+
...target,
|
|
390
|
+
mode: {
|
|
391
|
+
kind: 'navigate',
|
|
392
|
+
focus: true,
|
|
393
|
+
flash: true
|
|
394
|
+
}
|
|
395
|
+
}),
|
|
396
|
+
onLauncherEnd: setLauncherEnd,
|
|
397
|
+
labels: labels,
|
|
398
|
+
dataTestId: `${dataTestId}-minimap`
|
|
399
|
+
}),
|
|
400
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("section", {
|
|
401
|
+
ref: setScroller,
|
|
402
|
+
"aria-label": labels.graph,
|
|
403
|
+
className: external_decisionGraphStyles_cjs_namespaceObject.GRAPH_SCROLLER_CLASS,
|
|
404
|
+
style: {
|
|
405
|
+
scrollPaddingInlineStart: launcherEnd + external_decisionGraphStyles_cjs_namespaceObject.GRAPH_MINIMAP_GAP_PX
|
|
406
|
+
},
|
|
407
|
+
"data-testid": `${dataTestId}-scroller`,
|
|
408
|
+
children: [
|
|
409
|
+
0 === nodes.length && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
|
|
410
|
+
className: external_decisionGraphStyles_cjs_namespaceObject.GRAPH_EMPTY_CLASS,
|
|
411
|
+
"data-testid": `${dataTestId}-empty`,
|
|
412
|
+
children: labels.empty
|
|
413
|
+
}),
|
|
414
|
+
(nodes.length > 0 || actions.addTop) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
415
|
+
className: external_decisionGraphStyles_cjs_namespaceObject.GRAPH_COLUMN_CLASS,
|
|
416
|
+
style: {
|
|
417
|
+
paddingLeft: (0, external_decisionGraphStyles_cjs_namespaceObject.graphColumnInsetOf)(launcherEnd)
|
|
418
|
+
},
|
|
419
|
+
onFocus: onFocus,
|
|
420
|
+
children: [
|
|
421
|
+
(0, external_decisionGraphPositions_cjs_namespaceObject.topPositionsOf)(nodes).map((position)=>{
|
|
422
|
+
const node = nodes[position.index];
|
|
423
|
+
return node && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
424
|
+
children: branch(node, 0, position)
|
|
425
|
+
}, node.id);
|
|
426
|
+
}),
|
|
427
|
+
actions.addTop && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
|
|
428
|
+
type: "button",
|
|
429
|
+
className: external_decisionGraphStyles_cjs_namespaceObject.GRAPH_ADD_DECISION_CLASS,
|
|
430
|
+
onClick: actions.addTop,
|
|
431
|
+
"data-graph-add": true,
|
|
432
|
+
"data-testid": `${dataTestId}-add-decision`,
|
|
433
|
+
children: [
|
|
434
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Plus, {
|
|
435
|
+
"aria-hidden": true
|
|
436
|
+
}),
|
|
437
|
+
labels.addDecision
|
|
438
|
+
]
|
|
439
|
+
})
|
|
440
|
+
]
|
|
441
|
+
})
|
|
442
|
+
]
|
|
443
|
+
}),
|
|
444
|
+
actions.dialogs,
|
|
445
|
+
region
|
|
446
|
+
]
|
|
447
|
+
});
|
|
448
|
+
};
|
|
38
449
|
exports.DecisionGraphText = __webpack_exports__.DecisionGraphText;
|
|
39
450
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
40
451
|
"DecisionGraphText"
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { type DecisionGraphMinimapSlotProps } from './DecisionGraphMinimapSlot';
|
|
3
|
+
import { type DecisionTextProps } from './DecisionText';
|
|
4
|
+
import type { DecisionGraphMode } from './decisionGraphActionTypes';
|
|
5
|
+
import type { DecisionGraphBodyContext, DecisionGraphCitations, DecisionGraphExpansion, DecisionGraphNode } from './decisionGraphTypes';
|
|
6
|
+
export type DecisionGraphBody<Op, Policy, Total, Type, TextRefusal> = {
|
|
7
|
+
kind: 'table';
|
|
8
|
+
text: Omit<DecisionTextProps<Op, Policy, Total, Type, TextRefusal>, 'scroll' | 'onOpenDecision'>;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'other';
|
|
11
|
+
content: React.ReactNode;
|
|
5
12
|
};
|
|
6
|
-
export
|
|
13
|
+
export interface DecisionGraphTextProps<Refusal, Logic, Op, Policy, Total, Type, TextRefusal> {
|
|
14
|
+
nodes: readonly DecisionGraphNode[];
|
|
15
|
+
mode: DecisionGraphMode<Refusal, Logic>;
|
|
16
|
+
renderBody: (decisionId: string, context: DecisionGraphBodyContext) => DecisionGraphBody<Op, Policy, Total, Type, TextRefusal>;
|
|
17
|
+
citations?: DecisionGraphCitations;
|
|
18
|
+
onFold?: (decisionId: string) => void;
|
|
19
|
+
expansion?: DecisionGraphExpansion;
|
|
20
|
+
onOpenDecision?: (decisionId: string) => void;
|
|
21
|
+
rules?: DecisionGraphMinimapSlotProps['rules'];
|
|
22
|
+
dataTestId: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const DecisionGraphText: <Refusal, Logic, Op, Policy, Total, Type, TextRefusal>({ nodes, mode, renderBody, citations, expansion, onFold, onOpenDecision, rules, dataTestId, }: DecisionGraphTextProps<Refusal, Logic, Op, Policy, Total, Type, TextRefusal>) => React.ReactElement;
|
|
7
25
|
//# sourceMappingURL=DecisionGraphText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionGraphText.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionGraphText.tsx"],"names":[],"mappings":"
|
|
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,EAAgB,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAoBpE,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,EAEtB,sBAAsB,EACtB,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAW9B,MAAM,MAAM,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,IAC9D;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,IAAI,CACR,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,EACvD,QAAQ,GAAG,gBAAgB,CAC5B,CAAC;CACH,GACD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;AAEhD,MAAM,WAAW,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW;IAE1F,KAAK,EAAE,SAAS,iBAAiB,EAAE,CAAC;IAEpC,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAExC,UAAU,EAAE,CACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,wBAAwB,KAC9B,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAE7D,SAAS,CAAC,EAAE,sBAAsB,CAAC;IAEnC,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,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,+FAUrF,sBAAsB,CACvB,OAAO,EACP,KAAK,EACL,EAAE,EACF,MAAM,EACN,KAAK,EACL,IAAI,EACJ,WAAW,CACZ,KAAG,KAAK,CAAC,YAsUT,CAAC"}
|