@uipath/apollo-react 7.34.0 → 7.36.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 (60) 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/DecisionGraphText.cjs +398 -6
  6. package/dist/decision-table/DecisionGraphText.d.ts +15 -5
  7. package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
  8. package/dist/decision-table/DecisionGraphText.js +399 -7
  9. package/dist/decision-table/DecisionText.cjs +16 -2
  10. package/dist/decision-table/DecisionText.d.ts +3 -3
  11. package/dist/decision-table/DecisionText.d.ts.map +1 -1
  12. package/dist/decision-table/DecisionText.js +16 -2
  13. package/dist/decision-table/__fixtures__/textMode.d.ts +3 -3
  14. package/dist/decision-table/__fixtures__/textMode.d.ts.map +1 -1
  15. package/dist/decision-table/__fixtures__/useStoryHistory.d.ts +7 -0
  16. package/dist/decision-table/__fixtures__/useStoryHistory.d.ts.map +1 -0
  17. package/dist/decision-table/decisionGraphActionTypes.d.ts +8 -0
  18. package/dist/decision-table/decisionGraphActionTypes.d.ts.map +1 -1
  19. package/dist/decision-table/decisionGraphTypes.d.ts +3 -0
  20. package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
  21. package/dist/decision-table/index.cjs +54 -62
  22. package/dist/decision-table/index.d.ts +1 -2
  23. package/dist/decision-table/index.d.ts.map +1 -1
  24. package/dist/decision-table/index.js +1 -2
  25. package/dist/decision-table/revealIn.cjs +59 -0
  26. package/dist/decision-table/revealIn.d.ts +7 -0
  27. package/dist/decision-table/revealIn.d.ts.map +1 -0
  28. package/dist/decision-table/revealIn.js +25 -0
  29. package/dist/decision-table/sentenceTargets.cjs +5 -1
  30. package/dist/decision-table/sentenceTargets.d.ts +1 -0
  31. package/dist/decision-table/sentenceTargets.d.ts.map +1 -1
  32. package/dist/decision-table/sentenceTargets.js +2 -1
  33. package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
  34. package/dist/decision-table/useContainerHandlers.cjs +19 -6
  35. package/dist/decision-table/useContainerHandlers.d.ts +8 -2
  36. package/dist/decision-table/useContainerHandlers.d.ts.map +1 -1
  37. package/dist/decision-table/useContainerHandlers.js +21 -8
  38. package/dist/decision-table/useGridLayout.cjs +12 -2
  39. package/dist/decision-table/useGridLayout.d.ts.map +1 -1
  40. package/dist/decision-table/useGridLayout.js +12 -2
  41. package/dist/decision-table/useRuleWindow.cjs +9 -4
  42. package/dist/decision-table/useRuleWindow.d.ts +1 -1
  43. package/dist/decision-table/useRuleWindow.d.ts.map +1 -1
  44. package/dist/decision-table/useRuleWindow.js +9 -4
  45. package/dist/decision-table/useValueEditing.cjs +1 -2
  46. package/dist/decision-table/useValueEditing.d.ts.map +1 -1
  47. package/dist/decision-table/useValueEditing.js +1 -2
  48. package/dist/decision-table/useVirtualizedAxis.cjs +17 -14
  49. package/dist/decision-table/useVirtualizedAxis.d.ts +2 -2
  50. package/dist/decision-table/useVirtualizedAxis.d.ts.map +1 -1
  51. package/dist/decision-table/useVirtualizedAxis.js +17 -14
  52. package/package.json +2 -2
  53. package/dist/decision-table/DecisionGraphView.cjs +0 -409
  54. package/dist/decision-table/DecisionGraphView.d.ts +0 -20
  55. package/dist/decision-table/DecisionGraphView.d.ts.map +0 -1
  56. package/dist/decision-table/DecisionGraphView.js +0 -375
  57. package/dist/decision-table/EditableDecisionGraphText.cjs +0 -40
  58. package/dist/decision-table/EditableDecisionGraphText.d.ts +0 -5
  59. package/dist/decision-table/EditableDecisionGraphText.d.ts.map +0 -1
  60. package/dist/decision-table/EditableDecisionGraphText.js +0 -6
@@ -1,375 +0,0 @@
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, topPositionsOf, usersOf } from "./decisionGraphPositions.js";
8
- import { GRAPH_ADD_DECISION_CLASS, GRAPH_BRANCH_CLASS, GRAPH_COLUMN_CLASS, GRAPH_EMPTY_CLASS, GRAPH_FRAME_CLASS, GRAPH_NEST_CLASS, GRAPH_OUTPUT_HUE_CLASS, GRAPH_SCROLLER_CLASS, graphColumnInsetOf } from "./decisionGraphStyles.js";
9
- import { SENTENCE_MIN_RULE_HEIGHT_PX } from "./sentenceRuleHeights.js";
10
- import { useDecisionGraphActions } from "./useDecisionGraphActions.js";
11
- import { useDecisionGraphLabels } from "./useDecisionGraphStrings.js";
12
- import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
13
- import { contentTopIn } from "./useRuleWindow.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 focuses = (mode)=>'navigate' === mode.kind && mode.focus;
25
- const flashes = (mode)=>'inPlace' === mode.kind || mode.flash;
26
- const prefersReducedMotion = ()=>'function' == typeof matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches;
27
- const flash = (element)=>{
28
- if (prefersReducedMotion()) return;
29
- element.animate?.([
30
- {
31
- boxShadow: '0 0 0 4px color-mix(in srgb, var(--color-primary) 40%, transparent)'
32
- },
33
- {
34
- boxShadow: '0 0 0 0 transparent'
35
- }
36
- ], {
37
- duration: 1400,
38
- easing: 'ease-out'
39
- });
40
- };
41
- const scrollTo = (scroller, top)=>scroller.scrollTo?.({
42
- top
43
- });
44
- const NEAR_MARGIN = '100% 0px';
45
- const nearAfter = (current, entries)=>{
46
- let next;
47
- for (const { target, isIntersecting } of entries){
48
- const decisionId = target instanceof HTMLElement ? target.dataset.decisionId : void 0;
49
- if (void 0 !== decisionId && (next ?? current).has(decisionId) !== isIntersecting) {
50
- next ??= new Set(current);
51
- if (isIntersecting) next.add(decisionId);
52
- else next.delete(decisionId);
53
- }
54
- }
55
- return next ?? current;
56
- };
57
- const bodyHeightOf = (card)=>{
58
- const body = card.querySelector(':scope > [data-graph-body]');
59
- if (!body || body.querySelector(':scope > [data-graph-placeholder]')) return null;
60
- return body.offsetHeight || null;
61
- };
62
- const ruleCountsOf = (nodes)=>{
63
- const counts = new Map();
64
- const visit = (node)=>{
65
- if ('decision' !== node.kind) return;
66
- if ('table' === node.logic.kind) counts.set(node.id, node.logic.ruleCount);
67
- for (const child of node.children)visit(child);
68
- };
69
- for (const node of nodes)visit(node);
70
- return counts;
71
- };
72
- const perRuleHeightOf = (heights, ruleCounts)=>{
73
- let height = 0;
74
- let rules = 0;
75
- for (const [decisionId, measured] of heights){
76
- const count = ruleCounts.get(decisionId) ?? 0;
77
- if (0 !== count) {
78
- height += measured;
79
- rules += count;
80
- }
81
- }
82
- return 0 === rules ? SENTENCE_MIN_RULE_HEIGHT_PX : height / rules;
83
- };
84
- const DecisionGraphView = ({ nodes, mode, renderBody, expansion, onFold, selected = null, onReveal, onOpenDecision, rules, dataTestId })=>{
85
- const labels = useDecisionGraphLabels();
86
- const { announce, region } = useTextAnnouncements(useDecisionTextLabels(), dataTestId);
87
- const idPrefix = useId();
88
- const [ownExpanded, setOwnExpanded] = useState(NO_EXPANDED);
89
- const expanded = expansion?.expanded ?? ownExpanded;
90
- const users = useMemo(()=>usersOf(nodes), [
91
- nodes
92
- ]);
93
- const [scroller, setScroller] = useState(null);
94
- const [launcherEnd, setLauncherEnd] = useState(0);
95
- const cardsRef = useRef(new Map());
96
- const [pending, setPending] = useState(null);
97
- const [near, setNear] = useState(()=>"u" < typeof IntersectionObserver ? null : NO_EXPANDED);
98
- const [revealed, setRevealed] = useState(null);
99
- const [focused, setFocused] = useState(null);
100
- const heightsRef = useRef(new Map());
101
- const observersRef = useRef(null);
102
- const ruleCounts = useMemo(()=>ruleCountsOf(nodes), [
103
- nodes
104
- ]);
105
- const setExpanded = (next)=>{
106
- if (expansion) expansion.onChange(next);
107
- else setOwnExpanded(next);
108
- };
109
- const toggle = (decisionId)=>{
110
- const next = new Set(expanded);
111
- const folds = next.delete(decisionId);
112
- if (!folds) next.add(decisionId);
113
- setExpanded(next);
114
- if (folds) onFold?.(decisionId);
115
- };
116
- const reveal = (target)=>{
117
- if (!expanded.has(target.decisionId)) setExpanded(new Set([
118
- ...expanded,
119
- target.decisionId
120
- ]));
121
- setPending(target);
122
- setRevealed(target.decisionId);
123
- if ('navigate' === target.mode.kind) onReveal?.('rule' === target.kind ? {
124
- kind: 'rule',
125
- decisionId: target.decisionId,
126
- rowId: target.rowId
127
- } : {
128
- kind: 'decision',
129
- decisionId: target.decisionId
130
- });
131
- };
132
- const openOf = (decisionId)=>onOpenDecision && (()=>onOpenDecision(decisionId));
133
- const actions = useDecisionGraphActions({
134
- mode,
135
- nodes,
136
- labels,
137
- openOf,
138
- cardOf: (decisionId)=>cardsRef.current.get(decisionId),
139
- scroller,
140
- announce,
141
- dataTestId
142
- });
143
- const cardRefsRef = useRef(new Map());
144
- const cardRef = useCallback((decisionId)=>{
145
- const cached = cardRefsRef.current.get(decisionId);
146
- if (cached) return cached;
147
- const attach = (element)=>{
148
- const observers = observersRef.current;
149
- const previous = cardsRef.current.get(decisionId);
150
- if (previous && previous !== element) {
151
- observers?.near.unobserve(previous);
152
- observers?.size?.unobserve(previous);
153
- }
154
- if (!element) return void cardsRef.current.delete(decisionId);
155
- cardsRef.current.set(decisionId, element);
156
- observers?.near.observe(element);
157
- observers?.size?.observe(element);
158
- };
159
- cardRefsRef.current.set(decisionId, attach);
160
- return attach;
161
- }, []);
162
- useLayoutEffect(()=>{
163
- if (!scroller || "u" < typeof IntersectionObserver) return;
164
- const remember = (card)=>{
165
- if (!(card instanceof HTMLElement)) return;
166
- const decisionId = card.dataset.decisionId;
167
- const height = bodyHeightOf(card);
168
- if (void 0 !== decisionId && null !== height) heightsRef.current.set(decisionId, height);
169
- };
170
- const nearObserver = new IntersectionObserver((entries)=>{
171
- for (const { target } of entries)remember(target);
172
- setNear((current)=>nearAfter(current ?? NO_EXPANDED, entries));
173
- }, {
174
- root: scroller,
175
- rootMargin: NEAR_MARGIN
176
- });
177
- const sizeObserver = "u" < typeof ResizeObserver ? null : new ResizeObserver((entries)=>{
178
- for (const { target } of entries)remember(target);
179
- });
180
- observersRef.current = {
181
- near: nearObserver,
182
- size: sizeObserver
183
- };
184
- for (const card of cardsRef.current.values()){
185
- nearObserver.observe(card);
186
- sizeObserver?.observe(card);
187
- }
188
- return ()=>{
189
- nearObserver.disconnect();
190
- sizeObserver?.disconnect();
191
- observersRef.current = null;
192
- };
193
- }, [
194
- scroller
195
- ]);
196
- const perRuleHeight = perRuleHeightOf(heightsRef.current, ruleCounts);
197
- const bodyOf = (decisionId, scrollContainer)=>{
198
- const mounted = null === near || near.has(decisionId) || decisionId === selected || decisionId === revealed || decisionId === focused;
199
- if (mounted) return renderBody(decisionId, {
200
- container: scrollContainer
201
- });
202
- const height = heightsRef.current.get(decisionId) ?? Math.max(1, ruleCounts.get(decisionId) ?? 1) * perRuleHeight;
203
- return /*#__PURE__*/ jsx("div", {
204
- "aria-hidden": true,
205
- "data-graph-placeholder": true,
206
- style: {
207
- height
208
- }
209
- });
210
- };
211
- const onFocus = (event)=>{
212
- const card = event.target instanceof Element ? event.target.closest('[data-decision-id]') : null;
213
- const decisionId = card instanceof HTMLElement ? card.dataset.decisionId : void 0;
214
- if (void 0 !== decisionId) setFocused(decisionId);
215
- };
216
- useLayoutEffect(()=>{
217
- if (!pending) return;
218
- const apply = ()=>{
219
- const card = cardsRef.current.get(pending.decisionId);
220
- if (!scroller || !card) return false;
221
- if ('decision' === pending.kind) {
222
- if ('navigate' === pending.mode.kind) scrollTo(scroller, contentTopIn(card, scroller));
223
- if (focuses(pending.mode)) card.querySelector('[data-graph-toggle]')?.focus({
224
- preventScroll: true
225
- });
226
- if (flashes(pending.mode)) flash(card);
227
- return true;
228
- }
229
- const rule = card.querySelector(`li[data-row-id="${CSS.escape(pending.rowId)}"]`);
230
- if (!rule) return false;
231
- if ('navigate' === pending.mode.kind) scrollTo(scroller, contentTopIn(rule, scroller) - (scroller.clientHeight - rule.offsetHeight) / 2);
232
- if (focuses(pending.mode)) {
233
- if (!rule.hasAttribute('tabindex')) rule.tabIndex = -1;
234
- rule.focus({
235
- preventScroll: true
236
- });
237
- }
238
- if (flashes(pending.mode)) flash(rule);
239
- return true;
240
- };
241
- if (apply()) return void setPending(null);
242
- const frame = requestAnimationFrame(()=>{
243
- const card = cardsRef.current.get(pending.decisionId);
244
- if (!apply() && flashes(pending.mode) && card) flash(card);
245
- setPending(null);
246
- });
247
- return ()=>cancelAnimationFrame(frame);
248
- });
249
- const branch = (node, depth, position)=>{
250
- if ('reference' === node.kind) return /*#__PURE__*/ jsx(DecisionGraphReference, {
251
- node: node,
252
- labels: labels,
253
- actions: actions.referenceOf(node, position),
254
- onReveal: ()=>reveal({
255
- kind: 'decision',
256
- decisionId: node.targetId,
257
- mode: {
258
- kind: 'navigate',
259
- focus: false,
260
- flash: false
261
- }
262
- }),
263
- onOpen: openOf(node.targetId),
264
- dataTestId: dataTestId
265
- });
266
- const open = expanded.has(node.id);
267
- return /*#__PURE__*/ jsxs(Fragment, {
268
- children: [
269
- /*#__PURE__*/ jsx(DecisionGraphCard, {
270
- node: node,
271
- depth: depth,
272
- open: open,
273
- active: selected === node.id,
274
- usedBy: (users.get(node.id) ?? []).map((user)=>user.label),
275
- bodyId: `${idPrefix}-${encodeURIComponent(node.id)}`,
276
- body: open && scroller ? bodyOf(node.id, scroller) : null,
277
- labels: labels,
278
- onToggle: ()=>toggle(node.id),
279
- onShowProblem: (byKey)=>reveal({
280
- ...markTargetOf(node),
281
- mode: byKey ? {
282
- kind: 'navigate',
283
- focus: true,
284
- flash: true
285
- } : {
286
- kind: 'inPlace'
287
- }
288
- }),
289
- onOpen: openOf(node.id),
290
- actions: actions.cardOf(node, position),
291
- cardRef: cardRef(node.id),
292
- dataTestId: dataTestId
293
- }),
294
- node.children.length > 0 && /*#__PURE__*/ jsx("div", {
295
- className: GRAPH_NEST_CLASS,
296
- "data-graph-nest-of": node.id,
297
- children: childPositionsOf(node, position).map((childPosition)=>{
298
- const child = node.children[childPosition.index];
299
- return child && /*#__PURE__*/ jsx("div", {
300
- className: GRAPH_BRANCH_CLASS,
301
- children: branch(child, depth + 1, childPosition)
302
- }, child.id);
303
- })
304
- })
305
- ]
306
- });
307
- };
308
- return /*#__PURE__*/ jsxs("div", {
309
- className: cn(GRAPH_FRAME_CLASS, GRAPH_OUTPUT_HUE_CLASS),
310
- "data-testid": dataTestId,
311
- ...actions.focusWithin,
312
- children: [
313
- nodes.length > 0 && /*#__PURE__*/ jsx(DecisionGraphMinimapSlot, {
314
- nodes: nodes,
315
- rules: rules,
316
- selected: selected,
317
- onPick: (target)=>reveal({
318
- ...target,
319
- mode: {
320
- kind: 'navigate',
321
- focus: true,
322
- flash: true
323
- }
324
- }),
325
- onLauncherEnd: setLauncherEnd,
326
- labels: labels,
327
- dataTestId: `${dataTestId}-minimap`
328
- }),
329
- /*#__PURE__*/ jsxs("section", {
330
- ref: setScroller,
331
- "aria-label": labels.graph,
332
- className: GRAPH_SCROLLER_CLASS,
333
- "data-testid": `${dataTestId}-scroller`,
334
- children: [
335
- 0 === nodes.length && /*#__PURE__*/ jsx("p", {
336
- className: GRAPH_EMPTY_CLASS,
337
- "data-testid": `${dataTestId}-empty`,
338
- children: labels.empty
339
- }),
340
- (nodes.length > 0 || actions.addTop) && /*#__PURE__*/ jsxs("div", {
341
- className: GRAPH_COLUMN_CLASS,
342
- style: {
343
- paddingLeft: graphColumnInsetOf(launcherEnd)
344
- },
345
- onFocus: onFocus,
346
- children: [
347
- topPositionsOf(nodes).map((position)=>{
348
- const node = nodes[position.index];
349
- return node && /*#__PURE__*/ jsx("div", {
350
- children: branch(node, 0, position)
351
- }, node.id);
352
- }),
353
- actions.addTop && /*#__PURE__*/ jsxs("button", {
354
- type: "button",
355
- className: GRAPH_ADD_DECISION_CLASS,
356
- onClick: actions.addTop,
357
- "data-graph-add": true,
358
- "data-testid": `${dataTestId}-add-decision`,
359
- children: [
360
- /*#__PURE__*/ jsx(Plus, {
361
- "aria-hidden": true
362
- }),
363
- labels.addDecision
364
- ]
365
- })
366
- ]
367
- })
368
- ]
369
- }),
370
- actions.dialogs,
371
- region
372
- ]
373
- });
374
- };
375
- export { DecisionGraphView };
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- EditableDecisionGraphText: ()=>EditableDecisionGraphText
28
- });
29
- const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
- const external_DecisionGraphView_cjs_namespaceObject = require("./DecisionGraphView.cjs");
31
- const EditableDecisionGraphText = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DecisionGraphView_cjs_namespaceObject.DecisionGraphView, {
32
- ...props
33
- });
34
- exports.EditableDecisionGraphText = __webpack_exports__.EditableDecisionGraphText;
35
- for(var __rspack_i in __webpack_exports__)if (-1 === [
36
- "EditableDecisionGraphText"
37
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
38
- Object.defineProperty(exports, '__esModule', {
39
- value: true
40
- });
@@ -1,5 +0,0 @@
1
- import type React from 'react';
2
- import { type DecisionGraphViewProps } from './DecisionGraphView';
3
- export type EditableDecisionGraphTextProps<Refusal, Logic> = DecisionGraphViewProps<Refusal, Logic>;
4
- export declare const EditableDecisionGraphText: <Refusal, Logic>(props: EditableDecisionGraphTextProps<Refusal, Logic>) => React.ReactElement;
5
- //# sourceMappingURL=EditableDecisionGraphText.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditableDecisionGraphText.d.ts","sourceRoot":"","sources":["../../src/decision-table/EditableDecisionGraphText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAqB,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAErF,MAAM,MAAM,8BAA8B,CAAC,OAAO,EAAE,KAAK,IAAI,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAGpG,eAAO,MAAM,yBAAyB,GAAI,OAAO,EAAE,KAAK,EACtD,OAAO,8BAA8B,CAAC,OAAO,EAAE,KAAK,CAAC,KACpD,KAAK,CAAC,YAAgD,CAAC"}
@@ -1,6 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { DecisionGraphView } from "./DecisionGraphView.js";
3
- const EditableDecisionGraphText = (props)=>/*#__PURE__*/ jsx(DecisionGraphView, {
4
- ...props
5
- });
6
- export { EditableDecisionGraphText };