@uipath/apollo-react 7.36.0 → 8.1.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 (97) hide show
  1. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  2. package/dist/chat/styles/tailwind.chat.css +1 -1
  3. package/dist/decision-table/CitationButton.cjs +72 -0
  4. package/dist/decision-table/CitationButton.d.ts +33 -0
  5. package/dist/decision-table/CitationButton.d.ts.map +1 -0
  6. package/dist/decision-table/CitationButton.js +35 -0
  7. package/dist/decision-table/DecisionGraphCard.cjs +16 -2
  8. package/dist/decision-table/DecisionGraphCard.d.ts +5 -0
  9. package/dist/decision-table/DecisionGraphCard.d.ts.map +1 -1
  10. package/dist/decision-table/DecisionGraphCard.js +17 -3
  11. package/dist/decision-table/DecisionGraphText.cjs +12 -1
  12. package/dist/decision-table/DecisionGraphText.d.ts +3 -2
  13. package/dist/decision-table/DecisionGraphText.d.ts.map +1 -1
  14. package/dist/decision-table/DecisionGraphText.js +12 -1
  15. package/dist/decision-table/DecisionText.cjs +27 -2
  16. package/dist/decision-table/DecisionText.d.ts +4 -3
  17. package/dist/decision-table/DecisionText.d.ts.map +1 -1
  18. package/dist/decision-table/DecisionText.js +27 -2
  19. package/dist/decision-table/DecisionTextHeader.cjs +17 -1
  20. package/dist/decision-table/DecisionTextHeader.d.ts +7 -1
  21. package/dist/decision-table/DecisionTextHeader.d.ts.map +1 -1
  22. package/dist/decision-table/DecisionTextHeader.js +18 -2
  23. package/dist/decision-table/RuleCard.cjs +60 -26
  24. package/dist/decision-table/RuleCard.d.ts +2 -0
  25. package/dist/decision-table/RuleCard.d.ts.map +1 -1
  26. package/dist/decision-table/RuleCard.js +61 -27
  27. package/dist/decision-table/RuleList.cjs +2 -1
  28. package/dist/decision-table/RuleList.d.ts +1 -0
  29. package/dist/decision-table/RuleList.d.ts.map +1 -1
  30. package/dist/decision-table/RuleList.js +2 -1
  31. package/dist/decision-table/decisionGraphTypes.d.ts +8 -0
  32. package/dist/decision-table/decisionGraphTypes.d.ts.map +1 -1
  33. package/dist/decision-table/index.d.ts +2 -2
  34. package/dist/decision-table/index.d.ts.map +1 -1
  35. package/dist/decision-table/locales/de.cjs +1 -1
  36. package/dist/decision-table/locales/de.d.ts.map +1 -1
  37. package/dist/decision-table/locales/de.js +1 -1
  38. package/dist/decision-table/locales/en.cjs +1 -1
  39. package/dist/decision-table/locales/en.d.ts.map +1 -1
  40. package/dist/decision-table/locales/en.js +1 -1
  41. package/dist/decision-table/locales/es-MX.cjs +1 -1
  42. package/dist/decision-table/locales/es-MX.d.ts.map +1 -1
  43. package/dist/decision-table/locales/es-MX.js +1 -1
  44. package/dist/decision-table/locales/es.cjs +1 -1
  45. package/dist/decision-table/locales/es.d.ts.map +1 -1
  46. package/dist/decision-table/locales/es.js +1 -1
  47. package/dist/decision-table/locales/fr.cjs +1 -1
  48. package/dist/decision-table/locales/fr.d.ts.map +1 -1
  49. package/dist/decision-table/locales/fr.js +1 -1
  50. package/dist/decision-table/locales/ja.cjs +1 -1
  51. package/dist/decision-table/locales/ja.d.ts.map +1 -1
  52. package/dist/decision-table/locales/ja.js +1 -1
  53. package/dist/decision-table/locales/ko.cjs +1 -1
  54. package/dist/decision-table/locales/ko.d.ts.map +1 -1
  55. package/dist/decision-table/locales/ko.js +1 -1
  56. package/dist/decision-table/locales/pt-BR.cjs +1 -1
  57. package/dist/decision-table/locales/pt-BR.d.ts.map +1 -1
  58. package/dist/decision-table/locales/pt-BR.js +1 -1
  59. package/dist/decision-table/locales/pt.cjs +1 -1
  60. package/dist/decision-table/locales/pt.d.ts.map +1 -1
  61. package/dist/decision-table/locales/pt.js +1 -1
  62. package/dist/decision-table/locales/ro.cjs +1 -1
  63. package/dist/decision-table/locales/ro.d.ts.map +1 -1
  64. package/dist/decision-table/locales/ro.js +1 -1
  65. package/dist/decision-table/locales/ru.cjs +1 -1
  66. package/dist/decision-table/locales/ru.d.ts.map +1 -1
  67. package/dist/decision-table/locales/ru.js +1 -1
  68. package/dist/decision-table/locales/tr.cjs +1 -1
  69. package/dist/decision-table/locales/tr.d.ts.map +1 -1
  70. package/dist/decision-table/locales/tr.js +1 -1
  71. package/dist/decision-table/locales/zh-CN.cjs +1 -1
  72. package/dist/decision-table/locales/zh-CN.d.ts.map +1 -1
  73. package/dist/decision-table/locales/zh-CN.js +1 -1
  74. package/dist/decision-table/locales/zh-TW.cjs +1 -1
  75. package/dist/decision-table/locales/zh-TW.d.ts.map +1 -1
  76. package/dist/decision-table/locales/zh-TW.js +1 -1
  77. package/dist/decision-table/ruleCardModel.d.ts +2 -1
  78. package/dist/decision-table/ruleCardModel.d.ts.map +1 -1
  79. package/dist/decision-table/sentenceStyles.cjs +33 -6
  80. package/dist/decision-table/sentenceStyles.d.ts +8 -1
  81. package/dist/decision-table/sentenceStyles.d.ts.map +1 -1
  82. package/dist/decision-table/sentenceStyles.js +9 -3
  83. package/dist/decision-table/sentenceTypes.d.ts +28 -0
  84. package/dist/decision-table/sentenceTypes.d.ts.map +1 -1
  85. package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
  86. package/dist/decision-table/useContainerHandlers.cjs +88 -3
  87. package/dist/decision-table/useContainerHandlers.d.ts +10 -1
  88. package/dist/decision-table/useContainerHandlers.d.ts.map +1 -1
  89. package/dist/decision-table/useContainerHandlers.js +88 -3
  90. package/dist/decision-table/useDecisionGraphStrings.cjs +6 -2
  91. package/dist/decision-table/useDecisionGraphStrings.d.ts +2 -1
  92. package/dist/decision-table/useDecisionGraphStrings.d.ts.map +1 -1
  93. package/dist/decision-table/useDecisionGraphStrings.js +6 -2
  94. package/dist/decision-table/useDecisionTextStrings.cjs +36 -0
  95. package/dist/decision-table/useDecisionTextStrings.d.ts.map +1 -1
  96. package/dist/decision-table/useDecisionTextStrings.js +36 -0
  97. package/package.json +3 -3
@@ -30,8 +30,72 @@ const external_react_namespaceObject = require("react");
30
30
  const external_gridEvents_cjs_namespaceObject = require("./gridEvents.cjs");
31
31
  const external_sentenceTargets_cjs_namespaceObject = require("./sentenceTargets.cjs");
32
32
  const external_useSentenceNavigation_cjs_namespaceObject = require("./useSentenceNavigation.cjs");
33
+ const clickedCitationOf = (target, view)=>{
34
+ const button = target instanceof Element ? target.closest('[data-rule-action="citation"]') : null;
35
+ if (!button) return;
36
+ return (card)=>{
37
+ const active = button.ownerDocument.activeElement;
38
+ const movedOut = null !== active && active !== button.ownerDocument.body && !view.contains(active);
39
+ if (movedOut) return null;
40
+ return card.contains(button) ? button : card;
41
+ };
42
+ };
43
+ const citationButtonsOf = (view, rowId)=>[
44
+ ...view.querySelectorAll('li[data-row-id]')
45
+ ].filter((card)=>card.dataset.rowId === rowId).flatMap((card)=>[
46
+ ...card.querySelectorAll('[data-rule-action="citation"]')
47
+ ]);
48
+ const firstStop = (row)=>row && {
49
+ kind: 'citation',
50
+ row,
51
+ button: 0
52
+ };
53
+ const lastStop = (row)=>row && {
54
+ kind: 'citation',
55
+ row,
56
+ button: row.count - 1
57
+ };
58
+ const citationStopOf = (event, citedRows)=>{
59
+ if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
60
+ const view = event.currentTarget;
61
+ if (event.target === view) return 'Enter' === event.key ? firstStop(citedRows[0]) : void 0;
62
+ const target = event.target instanceof HTMLElement ? event.target : null;
63
+ const rowId = target?.closest('li[data-row-id]')?.dataset.rowId;
64
+ const at = citedRows.findIndex((row)=>row.rowId === rowId);
65
+ const row = citedRows[at];
66
+ const button = target && void 0 !== rowId ? citationButtonsOf(view, rowId).indexOf(target) : -1;
67
+ if (!row || button < 0) return;
68
+ if ('ArrowDown' === event.key) return button + 1 < row.count ? {
69
+ kind: 'citation',
70
+ row,
71
+ button: button + 1
72
+ } : firstStop(citedRows[at + 1]);
73
+ if ('ArrowUp' === event.key) return button > 0 ? {
74
+ kind: 'citation',
75
+ row,
76
+ button: button - 1
77
+ } : lastStop(citedRows[at - 1]);
78
+ if ('Home' === event.key) return firstStop(citedRows[0]);
79
+ if ('End' === event.key) return lastStop(citedRows[citedRows.length - 1]);
80
+ return 'Escape' === event.key ? {
81
+ kind: 'view'
82
+ } : void 0;
83
+ };
33
84
  const isTabOnView = (event)=>'Tab' === event.key && !event.shiftKey && event.target === event.currentTarget;
34
- const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history })=>{
85
+ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history, citationKeys, citedRows, revealRow, revealStop })=>{
86
+ const pendingCitationRef = (0, external_react_namespaceObject.useRef)(null);
87
+ const focusPendingCitation = ()=>{
88
+ const pending = pendingCitationRef.current;
89
+ const view = container();
90
+ const button = pending && view ? citationButtonsOf(view, pending.row.rowId)[pending.button] : void 0;
91
+ if (!pending || !button) return false;
92
+ pendingCitationRef.current = null;
93
+ button.focus({
94
+ preventScroll: true
95
+ });
96
+ revealStop(pending.row.index, button);
97
+ return true;
98
+ };
35
99
  const focusWithinRef = (0, external_react_namespaceObject.useRef)(false);
36
100
  const pressedRef = (0, external_react_namespaceObject.useRef)(false);
37
101
  const stopPressRef = (0, external_react_namespaceObject.useRef)(null);
@@ -41,6 +105,9 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
41
105
  if (focusWithinRef.current && view && (0, external_gridEvents_cjs_namespaceObject.hasLostFocus)(view)) view.focus();
42
106
  });
43
107
  (0, external_react_namespaceObject.useEffect)(()=>()=>stopPressRef.current?.(), []);
108
+ (0, external_react_namespaceObject.useEffect)(()=>{
109
+ focusPendingCitation();
110
+ });
44
111
  const endPress = ()=>{
45
112
  stopPressRef.current?.();
46
113
  stopPressRef.current = null;
@@ -84,11 +151,28 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
84
151
  step();
85
152
  return true;
86
153
  };
154
+ const moveAmongCitations = (event)=>{
155
+ const stop = citationKeys && !event.defaultPrevented ? citationStopOf(event, citedRows) : void 0;
156
+ if (!stop) return false;
157
+ event.preventDefault();
158
+ const view = event.currentTarget;
159
+ if ('view' === stop.kind) {
160
+ view.focus();
161
+ return true;
162
+ }
163
+ pendingCitationRef.current = {
164
+ row: stop.row,
165
+ button: stop.button
166
+ };
167
+ focusRow(stop.row.rowId);
168
+ if (!focusPendingCitation()) revealRow(stop.row.index);
169
+ return true;
170
+ };
87
171
  const onKeyDown = (event)=>{
88
172
  if (stopTabbable && isTabOnView(event)) {
89
173
  event.preventDefault();
90
174
  navigation.refocus();
91
- } else if (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event)) return;
175
+ } else if (!moveAmongCitations(event) && (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event))) return;
92
176
  consumerKeyDown?.(event);
93
177
  };
94
178
  const onFocus = (event)=>{
@@ -102,6 +186,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
102
186
  const onBlur = (event)=>{
103
187
  if (!(event.relatedTarget instanceof Node) || !event.currentTarget.contains(event.relatedTarget)) {
104
188
  focusWithinRef.current = false;
189
+ pendingCitationRef.current = null;
105
190
  endPress();
106
191
  setFocusInside(false);
107
192
  focusRow(void 0);
@@ -111,7 +196,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
111
196
  const onClick = (event)=>{
112
197
  const claimed = openDecision(event, (0, external_sentenceTargets_cjs_namespaceObject.clickedDecision)(event.target), 0 === event.detail) || ruleMenus.onClick(event) || valueEditing.onClick(event);
113
198
  const selection = claimed ? null : (0, external_sentenceTargets_cjs_namespaceObject.clickedSelection)(event.target);
114
- if (selection) navigation.select(selection, void 0, false);
199
+ if (selection) navigation.select(selection, clickedCitationOf(event.target, event.currentTarget), false);
115
200
  consumerClick?.(event);
116
201
  };
117
202
  return {
@@ -20,8 +20,17 @@ export interface ContainerHandlersParams {
20
20
  stopTabbable: boolean;
21
21
  focusRow: (rowId: string | undefined) => void;
22
22
  history: TextHistory | null;
23
+ citationKeys: boolean;
24
+ citedRows: readonly CitedRow[];
25
+ revealRow: RuleWindow['scrollRowIntoView'];
26
+ revealStop: RuleWindow['scrollStopIntoView'];
23
27
  }
24
- export declare const useContainerHandlers: ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history, }: ContainerHandlersParams) => {
28
+ export interface CitedRow {
29
+ rowId: string;
30
+ index: number;
31
+ count: number;
32
+ }
33
+ export declare const useContainerHandlers: ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history, citationKeys, citedRows, revealRow, revealStop, }: ContainerHandlersParams) => {
25
34
  tabIndex: number;
26
35
  onPointerOver: (event: React.PointerEvent<HTMLElement>) => void;
27
36
  onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useContainerHandlers.d.ts","sourceRoot":"","sources":["../../src/decision-table/useContainerHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiB/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EACjC,YAAY,GAAG,UAAU,CAC1B,GACC,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAG/C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,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} from "./gridEvents.js";
3
3
  import { clickedDecision, clickedSelection, rowIdOf, stopDecisionOf, valueTokenAt } from "./sentenceTargets.js";
4
4
  import { isIgnoredKey } from "./useSentenceNavigation.js";
5
+ const clickedCitationOf = (target, view)=>{
6
+ const button = target instanceof Element ? target.closest('[data-rule-action="citation"]') : null;
7
+ if (!button) return;
8
+ return (card)=>{
9
+ const active = button.ownerDocument.activeElement;
10
+ const movedOut = null !== active && active !== button.ownerDocument.body && !view.contains(active);
11
+ if (movedOut) return null;
12
+ return card.contains(button) ? button : card;
13
+ };
14
+ };
15
+ const citationButtonsOf = (view, rowId)=>[
16
+ ...view.querySelectorAll('li[data-row-id]')
17
+ ].filter((card)=>card.dataset.rowId === rowId).flatMap((card)=>[
18
+ ...card.querySelectorAll('[data-rule-action="citation"]')
19
+ ]);
20
+ const firstStop = (row)=>row && {
21
+ kind: 'citation',
22
+ row,
23
+ button: 0
24
+ };
25
+ const lastStop = (row)=>row && {
26
+ kind: 'citation',
27
+ row,
28
+ button: row.count - 1
29
+ };
30
+ const citationStopOf = (event, citedRows)=>{
31
+ if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
32
+ const view = event.currentTarget;
33
+ if (event.target === view) return 'Enter' === event.key ? firstStop(citedRows[0]) : void 0;
34
+ const target = event.target instanceof HTMLElement ? event.target : null;
35
+ const rowId = target?.closest('li[data-row-id]')?.dataset.rowId;
36
+ const at = citedRows.findIndex((row)=>row.rowId === rowId);
37
+ const row = citedRows[at];
38
+ const button = target && void 0 !== rowId ? citationButtonsOf(view, rowId).indexOf(target) : -1;
39
+ if (!row || button < 0) return;
40
+ if ('ArrowDown' === event.key) return button + 1 < row.count ? {
41
+ kind: 'citation',
42
+ row,
43
+ button: button + 1
44
+ } : firstStop(citedRows[at + 1]);
45
+ if ('ArrowUp' === event.key) return button > 0 ? {
46
+ kind: 'citation',
47
+ row,
48
+ button: button - 1
49
+ } : lastStop(citedRows[at - 1]);
50
+ if ('Home' === event.key) return firstStop(citedRows[0]);
51
+ if ('End' === event.key) return lastStop(citedRows[citedRows.length - 1]);
52
+ return 'Escape' === event.key ? {
53
+ kind: 'view'
54
+ } : void 0;
55
+ };
5
56
  const isTabOnView = (event)=>'Tab' === event.key && !event.shiftKey && event.target === event.currentTarget;
6
- const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history })=>{
57
+ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditing, ruleMenus, onOpenDecision, container, stopTabbable, focusRow, history, citationKeys, citedRows, revealRow, revealStop })=>{
58
+ const pendingCitationRef = useRef(null);
59
+ const focusPendingCitation = ()=>{
60
+ const pending = pendingCitationRef.current;
61
+ const view = container();
62
+ const button = pending && view ? citationButtonsOf(view, pending.row.rowId)[pending.button] : void 0;
63
+ if (!pending || !button) return false;
64
+ pendingCitationRef.current = null;
65
+ button.focus({
66
+ preventScroll: true
67
+ });
68
+ revealStop(pending.row.index, button);
69
+ return true;
70
+ };
7
71
  const focusWithinRef = useRef(false);
8
72
  const pressedRef = useRef(false);
9
73
  const stopPressRef = useRef(null);
@@ -13,6 +77,9 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
13
77
  if (focusWithinRef.current && view && hasLostFocus(view)) view.focus();
14
78
  });
15
79
  useEffect(()=>()=>stopPressRef.current?.(), []);
80
+ useEffect(()=>{
81
+ focusPendingCitation();
82
+ });
16
83
  const endPress = ()=>{
17
84
  stopPressRef.current?.();
18
85
  stopPressRef.current = null;
@@ -56,11 +123,28 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
56
123
  step();
57
124
  return true;
58
125
  };
126
+ const moveAmongCitations = (event)=>{
127
+ const stop = citationKeys && !event.defaultPrevented ? citationStopOf(event, citedRows) : void 0;
128
+ if (!stop) return false;
129
+ event.preventDefault();
130
+ const view = event.currentTarget;
131
+ if ('view' === stop.kind) {
132
+ view.focus();
133
+ return true;
134
+ }
135
+ pendingCitationRef.current = {
136
+ row: stop.row,
137
+ button: stop.button
138
+ };
139
+ focusRow(stop.row.rowId);
140
+ if (!focusPendingCitation()) revealRow(stop.row.index);
141
+ return true;
142
+ };
59
143
  const onKeyDown = (event)=>{
60
144
  if (stopTabbable && isTabOnView(event)) {
61
145
  event.preventDefault();
62
146
  navigation.refocus();
63
- } else if (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event)) return;
147
+ } else if (!moveAmongCitations(event) && (openStopDecision(event) || valueEditing.onKeyDown(event) || navigation.onKeyDown(event) || stepHistory(event))) return;
64
148
  consumerKeyDown?.(event);
65
149
  };
66
150
  const onFocus = (event)=>{
@@ -74,6 +158,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
74
158
  const onBlur = (event)=>{
75
159
  if (!(event.relatedTarget instanceof Node) || !event.currentTarget.contains(event.relatedTarget)) {
76
160
  focusWithinRef.current = false;
161
+ pendingCitationRef.current = null;
77
162
  endPress();
78
163
  setFocusInside(false);
79
164
  focusRow(void 0);
@@ -83,7 +168,7 @@ const useContainerHandlers = ({ containerProps, hoverTo, navigation, valueEditin
83
168
  const onClick = (event)=>{
84
169
  const claimed = openDecision(event, clickedDecision(event.target), 0 === event.detail) || ruleMenus.onClick(event) || valueEditing.onClick(event);
85
170
  const selection = claimed ? null : clickedSelection(event.target);
86
- if (selection) navigation.select(selection, void 0, false);
171
+ if (selection) navigation.select(selection, clickedCitationOf(event.target, event.currentTarget), false);
87
172
  consumerClick?.(event);
88
173
  };
89
174
  return {
@@ -31,7 +31,7 @@ const useSafeLingui_cjs_namespaceObject = require("../i18n/useSafeLingui.cjs");
31
31
  const external_useDecisionTextStrings_cjs_namespaceObject = require("./useDecisionTextStrings.cjs");
32
32
  const useDecisionGraphLabels = ()=>{
33
33
  const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
34
- const { markStatus } = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)();
34
+ const { markStatus, openCitation, citationPage } = (0, external_useDecisionTextStrings_cjs_namespaceObject.useDecisionTextLabels)();
35
35
  return (0, external_react_namespaceObject.useMemo)(()=>({
36
36
  graph: _({
37
37
  id: 'decision-graph.graph',
@@ -70,6 +70,8 @@ const useDecisionGraphLabels = ()=>{
70
70
  }
71
71
  }),
72
72
  markStatus,
73
+ openCitation,
74
+ citationPage,
73
75
  minimap: _({
74
76
  id: 'decision-graph.minimap',
75
77
  message: 'Browse rules'
@@ -251,7 +253,9 @@ const useDecisionGraphLabels = ()=>{
251
253
  })
252
254
  }), [
253
255
  _,
254
- markStatus
256
+ markStatus,
257
+ openCitation,
258
+ citationPage
255
259
  ]);
256
260
  };
257
261
  exports.useDecisionGraphLabels = __webpack_exports__.useDecisionGraphLabels;
@@ -1,7 +1,8 @@
1
+ import type { CitationLabels } from './CitationButton';
1
2
  import type { DecisionGraphActionLabels } from './decisionGraphActionTypes';
2
3
  import type { DecisionGraphMinimapLabels } from './DecisionGraphMinimap';
3
4
  import type { MarkBadgeLabels } from './MarkBadge';
4
- export interface DecisionGraphLabels extends DecisionGraphMinimapLabels, MarkBadgeLabels, DecisionGraphActionLabels {
5
+ export interface DecisionGraphLabels extends DecisionGraphMinimapLabels, MarkBadgeLabels, CitationLabels, DecisionGraphActionLabels {
5
6
  graph: string;
6
7
  empty: string;
7
8
  ruleCount: (count: number) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"useDecisionGraphStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionGraphStrings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAInD,MAAM,WAAW,mBACf,SAAQ,0BAA0B,EAChC,eAAe,EACf,yBAAyB;IAE3B,KAAK,EAAE,MAAM,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AAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACzD,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC5C;AAGD,eAAO,MAAM,sBAAsB,QAAO,mBA+HzC,CAAC"}
@@ -3,7 +3,7 @@ import { useSafeLingui } from "../i18n/useSafeLingui.js";
3
3
  import { useDecisionTextLabels } from "./useDecisionTextStrings.js";
4
4
  const useDecisionGraphLabels = ()=>{
5
5
  const { _ } = useSafeLingui();
6
- const { markStatus } = useDecisionTextLabels();
6
+ const { markStatus, openCitation, citationPage } = useDecisionTextLabels();
7
7
  return useMemo(()=>({
8
8
  graph: _({
9
9
  id: 'decision-graph.graph',
@@ -42,6 +42,8 @@ const useDecisionGraphLabels = ()=>{
42
42
  }
43
43
  }),
44
44
  markStatus,
45
+ openCitation,
46
+ citationPage,
45
47
  minimap: _({
46
48
  id: 'decision-graph.minimap',
47
49
  message: 'Browse rules'
@@ -223,7 +225,9 @@ const useDecisionGraphLabels = ()=>{
223
225
  })
224
226
  }), [
225
227
  _,
226
- markStatus
228
+ markStatus,
229
+ openCitation,
230
+ citationPage
227
231
  ]);
228
232
  };
229
233
  export { useDecisionGraphLabels };
@@ -134,6 +134,42 @@ const useDecisionTextLabels = ()=>{
134
134
  input
135
135
  }
136
136
  }),
137
+ openCitation: (owner, page, index)=>{
138
+ const numbered = index ?? 0;
139
+ if ('rule' === owner.kind) return _({
140
+ id: 'decision-text.open_rule_citation',
141
+ message: 'Open source{index, plural, =0 {} other { #}} of rule {position}, page {page}',
142
+ values: {
143
+ index: numbered,
144
+ position: owner.position,
145
+ page
146
+ }
147
+ });
148
+ if ('decision' === owner.kind) return _({
149
+ id: 'decision-text.open_decision_citation',
150
+ message: 'Open source{index, plural, =0 {} other { #}} of {decision}, page {page}',
151
+ values: {
152
+ index: numbered,
153
+ decision: owner.name,
154
+ page
155
+ }
156
+ });
157
+ return _({
158
+ id: 'decision-text.open_table_citation',
159
+ message: 'Open source{index, plural, =0 {} other { #}} of this decision, page {page}',
160
+ values: {
161
+ index: numbered,
162
+ page
163
+ }
164
+ });
165
+ },
166
+ citationPage: (page)=>_({
167
+ id: 'decision-text.citation_page',
168
+ message: 'Page {page}',
169
+ values: {
170
+ page
171
+ }
172
+ }),
137
173
  changeStatus: (change)=>changes[change],
138
174
  movedFrom: (number)=>_({
139
175
  id: 'decision-text.moved_from',
@@ -1 +1 @@
1
- {"version":3,"file":"useDecisionTextStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionTextStrings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAItF,eAAO,MAAM,qBAAqB,QAAO,kBAkFxC,CAAC;AAGF,eAAO,MAAM,yBAAyB,QAAO,sBA8F5C,CAAC"}
1
+ {"version":3,"file":"useDecisionTextStrings.d.ts","sourceRoot":"","sources":["../../src/decision-table/useDecisionTextStrings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAItF,eAAO,MAAM,qBAAqB,QAAO,kBA0GxC,CAAC;AAGF,eAAO,MAAM,yBAAyB,QAAO,sBA8F5C,CAAC"}
@@ -105,6 +105,42 @@ const useDecisionTextLabels = ()=>{
105
105
  input
106
106
  }
107
107
  }),
108
+ openCitation: (owner, page, index)=>{
109
+ const numbered = index ?? 0;
110
+ if ('rule' === owner.kind) return _({
111
+ id: 'decision-text.open_rule_citation',
112
+ message: 'Open source{index, plural, =0 {} other { #}} of rule {position}, page {page}',
113
+ values: {
114
+ index: numbered,
115
+ position: owner.position,
116
+ page
117
+ }
118
+ });
119
+ if ('decision' === owner.kind) return _({
120
+ id: 'decision-text.open_decision_citation',
121
+ message: 'Open source{index, plural, =0 {} other { #}} of {decision}, page {page}',
122
+ values: {
123
+ index: numbered,
124
+ decision: owner.name,
125
+ page
126
+ }
127
+ });
128
+ return _({
129
+ id: 'decision-text.open_table_citation',
130
+ message: 'Open source{index, plural, =0 {} other { #}} of this decision, page {page}',
131
+ values: {
132
+ index: numbered,
133
+ page
134
+ }
135
+ });
136
+ },
137
+ citationPage: (page)=>_({
138
+ id: 'decision-text.citation_page',
139
+ message: 'Page {page}',
140
+ values: {
141
+ page
142
+ }
143
+ }),
108
144
  changeStatus: (change)=>changes[change],
109
145
  movedFrom: (number)=>_({
110
146
  id: 'decision-text.moved_from',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/apollo-react",
3
- "version": "7.36.0",
3
+ "version": "8.1.0",
4
4
  "description": "Apollo Design System - React component library with Material UI theming",
5
5
  "repository": {
6
6
  "type": "git",
@@ -253,8 +253,8 @@
253
253
  "zustand": "^5.0.9",
254
254
  "@uipath/apollo-core": "5.15.3",
255
255
  "@uipath/apollo-ui-icons": "1.2.1",
256
- "@uipath/apollo-ui-icons-react": "1.1.0",
257
- "@uipath/apollo-wind": "2.95.1"
256
+ "@uipath/apollo-wind": "2.95.1",
257
+ "@uipath/apollo-ui-icons-react": "1.1.0"
258
258
  },
259
259
  "devDependencies": {
260
260
  "@lingui/cli": "^5.6.1",