@itwin/presentation-hierarchies-react 2.0.0-alpha.6 → 2.0.0-alpha.61

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 (163) hide show
  1. package/CHANGELOG.md +1151 -11
  2. package/README.md +93 -160
  3. package/lib/presentation-hierarchies-react/FlatTreeNode.d.ts +49 -0
  4. package/lib/presentation-hierarchies-react/FlatTreeNode.d.ts.map +1 -0
  5. package/lib/presentation-hierarchies-react/FlatTreeNode.js +96 -0
  6. package/lib/presentation-hierarchies-react/FlatTreeNode.js.map +1 -0
  7. package/lib/presentation-hierarchies-react/LocalizationContext.d.ts +24 -0
  8. package/lib/presentation-hierarchies-react/LocalizationContext.d.ts.map +1 -0
  9. package/lib/presentation-hierarchies-react/LocalizationContext.js +40 -0
  10. package/lib/presentation-hierarchies-react/LocalizationContext.js.map +1 -0
  11. package/lib/presentation-hierarchies-react/Renderers.d.ts +92 -0
  12. package/lib/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
  13. package/lib/presentation-hierarchies-react/TreeNode.d.ts +80 -0
  14. package/lib/presentation-hierarchies-react/TreeNode.d.ts.map +1 -0
  15. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseIModelTree.d.ts +28 -15
  16. package/lib/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -0
  17. package/lib/presentation-hierarchies-react/UseIModelTree.js +183 -0
  18. package/lib/presentation-hierarchies-react/UseIModelTree.js.map +1 -0
  19. package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts +30 -0
  20. package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
  21. package/lib/presentation-hierarchies-react/UseNodeHighlighting.js +57 -0
  22. package/lib/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
  23. package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts +23 -0
  24. package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -0
  25. package/lib/presentation-hierarchies-react/UseSelectionHandler.js +124 -0
  26. package/lib/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -0
  27. package/lib/presentation-hierarchies-react/UseTree.d.ts +112 -0
  28. package/lib/presentation-hierarchies-react/UseTree.d.ts.map +1 -0
  29. package/lib/presentation-hierarchies-react/UseTree.js +298 -0
  30. package/lib/presentation-hierarchies-react/UseTree.js.map +1 -0
  31. package/lib/presentation-hierarchies-react/Utils.js +56 -0
  32. package/lib/presentation-hierarchies-react/Utils.js.map +1 -0
  33. package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js +10 -0
  34. package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -0
  35. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts +9 -0
  36. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts.map +1 -0
  37. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js +12 -0
  38. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js.map +1 -0
  39. package/lib/presentation-hierarchies-react/internal/TreeActions.js +294 -0
  40. package/lib/presentation-hierarchies-react/internal/TreeActions.js.map +1 -0
  41. package/lib/presentation-hierarchies-react/internal/TreeLoader.js +98 -0
  42. package/lib/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -0
  43. package/lib/presentation-hierarchies-react/internal/TreeModel.d.ts +1 -0
  44. package/lib/presentation-hierarchies-react/internal/TreeModel.js +115 -0
  45. package/lib/presentation-hierarchies-react/internal/TreeModel.js.map +1 -0
  46. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +35 -0
  47. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -0
  48. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js +141 -0
  49. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -0
  50. package/lib/presentation-hierarchies-react/internal/Utils.js +42 -0
  51. package/lib/presentation-hierarchies-react/internal/Utils.js.map +1 -0
  52. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +40 -0
  53. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
  54. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +387 -0
  55. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
  56. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +21 -0
  57. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
  58. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +185 -0
  59. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
  60. package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts +49 -0
  61. package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
  62. package/lib/presentation-hierarchies-react/stratakit/TreeAction.js +88 -0
  63. package/lib/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
  64. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +38 -0
  65. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
  66. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +77 -0
  67. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
  68. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts +29 -0
  69. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -0
  70. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js +91 -0
  71. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -0
  72. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts +31 -0
  73. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -0
  74. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js +155 -0
  75. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -0
  76. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.css +25 -0
  77. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +14 -0
  78. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
  79. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +540 -0
  80. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
  81. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +75 -0
  82. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
  83. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js +417 -0
  84. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
  85. package/lib/presentation-hierarchies-react-extract.d.ts +17 -0
  86. package/lib/presentation-hierarchies-react-extract.js +16 -0
  87. package/lib/presentation-hierarchies-react-stratakit.d.ts +8 -0
  88. package/lib/presentation-hierarchies-react-stratakit.js +8 -0
  89. package/lib/presentation-hierarchies-react.d.ts +11 -0
  90. package/lib/presentation-hierarchies-react.js +8 -0
  91. package/lib/public/locales/en/PresentationHierarchies_1.0.json +26 -0
  92. package/package.json +78 -56
  93. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +0 -75
  94. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +0 -1
  95. package/lib/esm/presentation-hierarchies-react/TreeNode.js +0 -12
  96. package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +0 -1
  97. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts +0 -15
  98. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts.map +0 -1
  99. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js +0 -22
  100. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js.map +0 -1
  101. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +0 -1
  102. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +0 -62
  103. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +0 -1
  104. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +0 -46
  105. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +0 -1
  106. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +0 -98
  107. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +0 -1
  108. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +0 -132
  109. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +0 -1
  110. package/lib/esm/presentation-hierarchies-react/UseTree.js +0 -242
  111. package/lib/esm/presentation-hierarchies-react/UseTree.js.map +0 -1
  112. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts +0 -2
  113. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts.map +0 -1
  114. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js +0 -11
  115. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +0 -1
  116. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +0 -53
  117. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +0 -1
  118. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +0 -307
  119. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +0 -1
  120. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +0 -44
  121. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +0 -1
  122. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +0 -94
  123. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +0 -1
  124. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +0 -70
  125. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +0 -1
  126. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +0 -153
  127. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +0 -1
  128. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +0 -28
  129. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +0 -1
  130. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +0 -128
  131. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +0 -1
  132. package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts +0 -23
  133. package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +0 -1
  134. package/lib/esm/presentation-hierarchies-react/internal/Utils.js +0 -58
  135. package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +0 -1
  136. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts +0 -21
  137. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts.map +0 -1
  138. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js +0 -30
  139. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js.map +0 -1
  140. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts +0 -73
  141. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts.map +0 -1
  142. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js +0 -34
  143. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js.map +0 -1
  144. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts +0 -25
  145. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
  146. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -40
  147. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
  148. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +0 -23
  149. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts.map +0 -1
  150. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js +0 -72
  151. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js.map +0 -1
  152. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts +0 -40
  153. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +0 -1
  154. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +0 -80
  155. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js.map +0 -1
  156. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts +0 -30
  157. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts.map +0 -1
  158. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js +0 -48
  159. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
  160. package/lib/esm/presentation-hierarchies-react.d.ts +0 -13
  161. package/lib/esm/presentation-hierarchies-react.d.ts.map +0 -1
  162. package/lib/esm/presentation-hierarchies-react.js +0 -16
  163. package/lib/esm/presentation-hierarchies-react.js.map +0 -1
@@ -0,0 +1,540 @@
1
+ import { useTranslation } from "../LocalizationContext.js";
2
+ import { TreeActionBase } from "./TreeAction.js";
3
+ import { useTreeNodeRenameContext } from "./TreeNodeRenameAction.js";
4
+ import { c } from "react-compiler-runtime";
5
+ import { cloneElement, forwardRef, isValidElement, memo, useEffect, useId, useRef, useState } from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { DropdownMenu, Tree, unstable_Popover } from "@stratakit/structures";
8
+ import { Description, IconButton, Spinner, Text, TextBox } from "@stratakit/bricks";
9
+ import "./TreeNodeRenderer.css";
10
+ import checkmarkSvg from "@stratakit/icons/checkmark.svg";
11
+ import dismissSvg from "@stratakit/icons/dismiss.svg";
12
+ import refreshSvg from "@stratakit/icons/refresh.svg";
13
+ //#region src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.tsx
14
+ /**
15
+ * A component that renders a given `TreeNode` using the `Tree.Item` component from `@stratakit/structures`.
16
+ *
17
+ * @internal
18
+ */
19
+ const StrataKitTreeNodeRenderer = memo(forwardRef(function HierarchyNode(props, forwardedRef) {
20
+ const $ = c(64);
21
+ let contextMenuActions;
22
+ let decorations;
23
+ let expandNode;
24
+ let inlineActions;
25
+ let menuActions;
26
+ let node;
27
+ let reloadTree;
28
+ let treeItemProps;
29
+ if ($[0] !== props) {
30
+ ({node, decorations, inlineActions, menuActions, contextMenuActions, expandNode, reloadTree, ...treeItemProps} = props);
31
+ $[0] = props;
32
+ $[1] = contextMenuActions;
33
+ $[2] = decorations;
34
+ $[3] = expandNode;
35
+ $[4] = inlineActions;
36
+ $[5] = menuActions;
37
+ $[6] = node;
38
+ $[7] = reloadTree;
39
+ $[8] = treeItemProps;
40
+ } else {
41
+ contextMenuActions = $[1];
42
+ decorations = $[2];
43
+ expandNode = $[3];
44
+ inlineActions = $[4];
45
+ menuActions = $[5];
46
+ node = $[6];
47
+ reloadTree = $[7];
48
+ treeItemProps = $[8];
49
+ }
50
+ const translate = useTranslation();
51
+ const renameContext = useTreeNodeRenameContext();
52
+ const [contextMenuProps, setContextMenuProps] = useState(void 0);
53
+ const label = treeItemProps.label ?? node.label;
54
+ let t0;
55
+ bb0: {
56
+ if (node.errors.some(_temp)) {
57
+ let t1;
58
+ if ($[9] !== translate) {
59
+ t1 = translate("retry");
60
+ $[9] = translate;
61
+ $[10] = t1;
62
+ } else t1 = $[10];
63
+ let t2;
64
+ if ($[11] !== node.id || $[12] !== reloadTree) {
65
+ t2 = () => reloadTree({
66
+ parentNodeId: node.id,
67
+ state: "reset"
68
+ });
69
+ $[11] = node.id;
70
+ $[12] = reloadTree;
71
+ $[13] = t2;
72
+ } else t2 = $[13];
73
+ let t3;
74
+ if ($[14] !== t1 || $[15] !== t2) {
75
+ t3 = [/* @__PURE__ */ jsx(TreeActionBase, {
76
+ label: t1,
77
+ onClick: t2,
78
+ visible: true,
79
+ icon: refreshSvg,
80
+ variant: "inline"
81
+ }, "retry")];
82
+ $[14] = t1;
83
+ $[15] = t2;
84
+ $[16] = t3;
85
+ } else t3 = $[16];
86
+ t0 = t3;
87
+ break bb0;
88
+ }
89
+ if (!inlineActions) {
90
+ t0 = void 0;
91
+ break bb0;
92
+ }
93
+ let t1;
94
+ if ($[17] !== inlineActions) {
95
+ t1 = injectActionVariant(inlineActions, "inline");
96
+ $[17] = inlineActions;
97
+ $[18] = t1;
98
+ } else t1 = $[18];
99
+ t0 = t1;
100
+ }
101
+ const inlineActionItems = t0;
102
+ let t1;
103
+ bb1: {
104
+ if (!menuActions) {
105
+ t1 = void 0;
106
+ break bb1;
107
+ }
108
+ let t2;
109
+ if ($[19] !== menuActions) {
110
+ t2 = injectActionVariant(menuActions, "default");
111
+ $[19] = menuActions;
112
+ $[20] = t2;
113
+ } else t2 = $[20];
114
+ t1 = t2;
115
+ }
116
+ const menuActionItems = t1;
117
+ let t2;
118
+ bb2: {
119
+ if (node.errors.some(_temp2)) {
120
+ t2 = void 0;
121
+ break bb2;
122
+ }
123
+ if (node.children !== true && node.children.length === 0) {
124
+ t2 = void 0;
125
+ break bb2;
126
+ }
127
+ t2 = node.isExpanded;
128
+ }
129
+ const expanded = t2;
130
+ let t3;
131
+ if ($[21] !== renameContext) {
132
+ t3 = renameContext ?? {};
133
+ $[21] = renameContext;
134
+ $[22] = t3;
135
+ } else t3 = $[22];
136
+ const { renameParameters, cancelRename } = t3;
137
+ const t4 = renameParameters?.commit;
138
+ const t5 = renameParameters?.labelValidationHint;
139
+ const t6 = renameParameters?.validate;
140
+ let t7;
141
+ if ($[23] !== cancelRename || $[24] !== node.label || $[25] !== t4 || $[26] !== t5 || $[27] !== t6) {
142
+ t7 = /* @__PURE__ */ jsx(LabelEditor, {
143
+ initialLabel: node.label,
144
+ onChange: t4,
145
+ onCancel: cancelRename,
146
+ labelValidationHint: t5,
147
+ validate: t6
148
+ });
149
+ $[23] = cancelRename;
150
+ $[24] = node.label;
151
+ $[25] = t4;
152
+ $[26] = t5;
153
+ $[27] = t6;
154
+ $[28] = t7;
155
+ } else t7 = $[28];
156
+ const labelEditor = t7;
157
+ const t8 = renameParameters?.nodeId === node.id;
158
+ let t9;
159
+ if ($[29] !== expandNode || $[30] !== node.id) {
160
+ t9 = (isExpanded) => {
161
+ expandNode(node.id, isExpanded);
162
+ };
163
+ $[29] = expandNode;
164
+ $[30] = node.id;
165
+ $[31] = t9;
166
+ } else t9 = $[31];
167
+ const t10 = t9;
168
+ const t11 = node.errors.length > 0 ? node.errors[0].id : void 0;
169
+ let t12;
170
+ if ($[32] !== contextMenuActions || $[33] !== treeItemProps) {
171
+ t12 = (e_1) => {
172
+ if (treeItemProps.onContextMenu) treeItemProps.onContextMenu(e_1);
173
+ if (!contextMenuActions) return;
174
+ e_1.preventDefault();
175
+ const actions = injectActionVariant(contextMenuActions, "context-menu");
176
+ if (actions.length === 0) return;
177
+ setContextMenuProps({
178
+ position: {
179
+ x: e_1.clientX,
180
+ y: e_1.clientY
181
+ },
182
+ actions
183
+ });
184
+ };
185
+ $[32] = contextMenuActions;
186
+ $[33] = treeItemProps;
187
+ $[34] = t12;
188
+ } else t12 = $[34];
189
+ let t13;
190
+ if ($[35] !== decorations || $[36] !== expanded || $[37] !== forwardedRef || $[38] !== inlineActionItems || $[39] !== label || $[40] !== menuActionItems || $[41] !== t10 || $[42] !== t11 || $[43] !== t12 || $[44] !== treeItemProps) {
191
+ t13 = /* @__PURE__ */ jsx(Tree.Item, {
192
+ ...treeItemProps,
193
+ ref: forwardedRef,
194
+ label,
195
+ expanded,
196
+ onExpandedChange: t10,
197
+ inlineActions: inlineActionItems,
198
+ actions: menuActionItems,
199
+ unstable_decorations: decorations,
200
+ error: t11,
201
+ onContextMenu: t12
202
+ });
203
+ $[35] = decorations;
204
+ $[36] = expanded;
205
+ $[37] = forwardedRef;
206
+ $[38] = inlineActionItems;
207
+ $[39] = label;
208
+ $[40] = menuActionItems;
209
+ $[41] = t10;
210
+ $[42] = t11;
211
+ $[43] = t12;
212
+ $[44] = treeItemProps;
213
+ $[45] = t13;
214
+ } else t13 = $[45];
215
+ let t14;
216
+ if ($[46] !== cancelRename || $[47] !== labelEditor || $[48] !== t13 || $[49] !== t8) {
217
+ t14 = /* @__PURE__ */ jsx(unstable_Popover, {
218
+ content: labelEditor,
219
+ placement: "bottom",
220
+ open: t8,
221
+ setOpen: cancelRename,
222
+ unmountOnHide: true,
223
+ children: t13
224
+ });
225
+ $[46] = cancelRename;
226
+ $[47] = labelEditor;
227
+ $[48] = t13;
228
+ $[49] = t8;
229
+ $[50] = t14;
230
+ } else t14 = $[50];
231
+ const t15 = contextMenuProps !== void 0;
232
+ let t16;
233
+ if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
234
+ t16 = (open) => {
235
+ if (!open) setContextMenuProps(void 0);
236
+ };
237
+ $[51] = t16;
238
+ } else t16 = $[51];
239
+ const t17 = `${node.id}-${contextMenuProps?.position.x ?? ""}-${contextMenuProps?.position.y ?? ""}`;
240
+ let t18;
241
+ if ($[52] !== contextMenuProps) {
242
+ t18 = contextMenuProps ? /* @__PURE__ */ jsx(DropdownMenu.Button, {
243
+ style: {
244
+ position: "fixed",
245
+ top: contextMenuProps.position.y,
246
+ left: contextMenuProps.position.x
247
+ },
248
+ render: /* @__PURE__ */ jsx("div", {})
249
+ }) : null;
250
+ $[52] = contextMenuProps;
251
+ $[53] = t18;
252
+ } else t18 = $[53];
253
+ const t19 = contextMenuProps?.actions;
254
+ let t20;
255
+ if ($[54] !== t19) {
256
+ t20 = /* @__PURE__ */ jsx(DropdownMenu.Content, {
257
+ focusable: true,
258
+ autoFocus: true,
259
+ children: t19
260
+ });
261
+ $[54] = t19;
262
+ $[55] = t20;
263
+ } else t20 = $[55];
264
+ let t21;
265
+ if ($[56] !== t15 || $[57] !== t17 || $[58] !== t18 || $[59] !== t20) {
266
+ t21 = /* @__PURE__ */ jsxs(DropdownMenu.Provider, {
267
+ open: t15,
268
+ setOpen: t16,
269
+ children: [t18, t20]
270
+ }, t17);
271
+ $[56] = t15;
272
+ $[57] = t17;
273
+ $[58] = t18;
274
+ $[59] = t20;
275
+ $[60] = t21;
276
+ } else t21 = $[60];
277
+ let t22;
278
+ if ($[61] !== t14 || $[62] !== t21) {
279
+ t22 = /* @__PURE__ */ jsxs(Fragment, { children: [t14, t21] });
280
+ $[61] = t14;
281
+ $[62] = t21;
282
+ $[63] = t22;
283
+ } else t22 = $[63];
284
+ return t22;
285
+ }));
286
+ const PlaceholderNode = memo(forwardRef(function PlaceholderNode(t0, forwardedRef) {
287
+ const $ = c(13);
288
+ let props;
289
+ if ($[0] !== t0) {
290
+ ({...props} = t0);
291
+ $[0] = t0;
292
+ $[1] = props;
293
+ } else props = $[1];
294
+ const translate = useTranslation();
295
+ let t1;
296
+ if ($[2] !== translate) {
297
+ t1 = translate("loading");
298
+ $[2] = translate;
299
+ $[3] = t1;
300
+ } else t1 = $[3];
301
+ let t2;
302
+ if ($[4] !== translate) {
303
+ t2 = translate("loading");
304
+ $[4] = translate;
305
+ $[5] = t2;
306
+ } else t2 = $[5];
307
+ let t3;
308
+ if ($[6] !== t2) {
309
+ t3 = /* @__PURE__ */ jsx(Spinner, {
310
+ size: "small",
311
+ title: t2
312
+ });
313
+ $[6] = t2;
314
+ $[7] = t3;
315
+ } else t3 = $[7];
316
+ let t4;
317
+ if ($[8] !== forwardedRef || $[9] !== props || $[10] !== t1 || $[11] !== t3) {
318
+ t4 = /* @__PURE__ */ jsx(Tree.Item, {
319
+ ...props,
320
+ ref: forwardedRef,
321
+ label: t1,
322
+ unstable_decorations: t3
323
+ });
324
+ $[8] = forwardedRef;
325
+ $[9] = props;
326
+ $[10] = t1;
327
+ $[11] = t3;
328
+ $[12] = t4;
329
+ } else t4 = $[12];
330
+ return t4;
331
+ }));
332
+ function LabelEditor(t0) {
333
+ const $ = c(49);
334
+ const { initialLabel, labelValidationHint, onChange, onCancel, validate } = t0;
335
+ const translate = useTranslation();
336
+ const inputRef = useRef(null);
337
+ const [newLabelValue, setNewLabelValue] = useState(initialLabel);
338
+ const [hasError, setHasError] = useState(false);
339
+ let t1;
340
+ if ($[0] !== initialLabel || $[1] !== newLabelValue || $[2] !== onCancel || $[3] !== onChange || $[4] !== validate) {
341
+ t1 = () => {
342
+ if (validate && !validate(newLabelValue)) {
343
+ setHasError(true);
344
+ return;
345
+ }
346
+ if (initialLabel !== newLabelValue) {
347
+ onChange?.(newLabelValue);
348
+ return;
349
+ }
350
+ onCancel?.();
351
+ };
352
+ $[0] = initialLabel;
353
+ $[1] = newLabelValue;
354
+ $[2] = onCancel;
355
+ $[3] = onChange;
356
+ $[4] = validate;
357
+ $[5] = t1;
358
+ } else t1 = $[5];
359
+ const handleLabelChange = t1;
360
+ let t2;
361
+ if ($[6] !== initialLabel || $[7] !== onCancel) {
362
+ t2 = () => {
363
+ setNewLabelValue(initialLabel);
364
+ onCancel?.();
365
+ };
366
+ $[6] = initialLabel;
367
+ $[7] = onCancel;
368
+ $[8] = t2;
369
+ } else t2 = $[8];
370
+ const cancelLabelChange = t2;
371
+ let t3;
372
+ let t4;
373
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
374
+ t3 = () => {
375
+ if (inputRef.current) {
376
+ inputRef.current.focus();
377
+ inputRef.current.select();
378
+ }
379
+ };
380
+ t4 = [];
381
+ $[9] = t3;
382
+ $[10] = t4;
383
+ } else {
384
+ t3 = $[9];
385
+ t4 = $[10];
386
+ }
387
+ useEffect(t3, t4);
388
+ const canRename = newLabelValue && newLabelValue !== initialLabel && !hasError;
389
+ const inputId = useId();
390
+ let t5;
391
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
392
+ t5 = { width: "100%" };
393
+ $[11] = t5;
394
+ } else t5 = $[11];
395
+ const t6 = hasError ? "with-error" : void 0;
396
+ let t7;
397
+ if ($[12] !== translate) {
398
+ t7 = translate("newLabel");
399
+ $[12] = translate;
400
+ $[13] = t7;
401
+ } else t7 = $[13];
402
+ let t8;
403
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
404
+ t8 = (event) => {
405
+ setNewLabelValue(event.target.value);
406
+ setHasError(false);
407
+ };
408
+ $[14] = t8;
409
+ } else t8 = $[14];
410
+ let t9;
411
+ if ($[15] !== cancelLabelChange || $[16] !== handleLabelChange) {
412
+ t9 = (event_0) => {
413
+ if (event_0.key === "Enter") handleLabelChange();
414
+ else if (event_0.key === "Escape") cancelLabelChange();
415
+ };
416
+ $[15] = cancelLabelChange;
417
+ $[16] = handleLabelChange;
418
+ $[17] = t9;
419
+ } else t9 = $[17];
420
+ let t10;
421
+ if ($[18] !== inputId || $[19] !== newLabelValue || $[20] !== t7 || $[21] !== t9) {
422
+ t10 = /* @__PURE__ */ jsx(TextBox.Input, {
423
+ id: inputId,
424
+ ref: inputRef,
425
+ "aria-label": t7,
426
+ value: newLabelValue,
427
+ onChange: t8,
428
+ onKeyUp: t9
429
+ });
430
+ $[18] = inputId;
431
+ $[19] = newLabelValue;
432
+ $[20] = t7;
433
+ $[21] = t9;
434
+ $[22] = t10;
435
+ } else t10 = $[22];
436
+ let t11;
437
+ if ($[23] !== t10 || $[24] !== t6) {
438
+ t11 = /* @__PURE__ */ jsx(TextBox.Root, {
439
+ style: t5,
440
+ className: t6,
441
+ children: t10
442
+ });
443
+ $[23] = t10;
444
+ $[24] = t6;
445
+ $[25] = t11;
446
+ } else t11 = $[25];
447
+ let t12;
448
+ if ($[26] !== translate) {
449
+ t12 = translate("cancel");
450
+ $[26] = translate;
451
+ $[27] = t12;
452
+ } else t12 = $[27];
453
+ let t13;
454
+ if ($[28] !== cancelLabelChange || $[29] !== t12) {
455
+ t13 = /* @__PURE__ */ jsx(IconButton, {
456
+ icon: dismissSvg,
457
+ label: t12,
458
+ onClick: cancelLabelChange
459
+ });
460
+ $[28] = cancelLabelChange;
461
+ $[29] = t12;
462
+ $[30] = t13;
463
+ } else t13 = $[30];
464
+ let t14;
465
+ if ($[31] !== translate) {
466
+ t14 = translate("confirm");
467
+ $[31] = translate;
468
+ $[32] = t14;
469
+ } else t14 = $[32];
470
+ const t15 = !canRename;
471
+ let t16;
472
+ if ($[33] !== handleLabelChange || $[34] !== t14 || $[35] !== t15) {
473
+ t16 = /* @__PURE__ */ jsx(IconButton, {
474
+ icon: checkmarkSvg,
475
+ label: t14,
476
+ onClick: handleLabelChange,
477
+ disabled: t15
478
+ });
479
+ $[33] = handleLabelChange;
480
+ $[34] = t14;
481
+ $[35] = t15;
482
+ $[36] = t16;
483
+ } else t16 = $[36];
484
+ let t17;
485
+ if ($[37] !== t11 || $[38] !== t13 || $[39] !== t16) {
486
+ t17 = /* @__PURE__ */ jsxs("div", {
487
+ className: "phr-node-label-editor-input-row",
488
+ children: [
489
+ t11,
490
+ t13,
491
+ t16
492
+ ]
493
+ });
494
+ $[37] = t11;
495
+ $[38] = t13;
496
+ $[39] = t16;
497
+ $[40] = t17;
498
+ } else t17 = $[40];
499
+ let t18;
500
+ if ($[41] !== hasError || $[42] !== inputId || $[43] !== labelValidationHint) {
501
+ t18 = labelValidationHint !== void 0 ? /* @__PURE__ */ jsx(Description, {
502
+ id: inputId,
503
+ tone: hasError ? "critical" : "neutral",
504
+ style: { display: "flex" },
505
+ children: /* @__PURE__ */ jsx(Text, {
506
+ variant: "caption-lg",
507
+ children: labelValidationHint
508
+ })
509
+ }) : void 0;
510
+ $[41] = hasError;
511
+ $[42] = inputId;
512
+ $[43] = labelValidationHint;
513
+ $[44] = t18;
514
+ } else t18 = $[44];
515
+ let t19;
516
+ if ($[45] !== initialLabel || $[46] !== t17 || $[47] !== t18) {
517
+ t19 = /* @__PURE__ */ jsxs("div", {
518
+ className: "phr-node-label-editor",
519
+ children: [t17, t18]
520
+ }, initialLabel);
521
+ $[45] = initialLabel;
522
+ $[46] = t17;
523
+ $[47] = t18;
524
+ $[48] = t19;
525
+ } else t19 = $[48];
526
+ return t19;
527
+ }
528
+ function injectActionVariant(actions, variant) {
529
+ return actions.filter((action) => isValidElement(action)).map((action) => cloneElement(action, { variant }));
530
+ }
531
+ function _temp(e) {
532
+ return e.type === "ChildrenLoad";
533
+ }
534
+ function _temp2(e_0) {
535
+ return e_0.type !== "Unknown" || !e_0.isNodeExpandable;
536
+ }
537
+ //#endregion
538
+ export { PlaceholderNode, StrataKitTreeNodeRenderer };
539
+
540
+ //# sourceMappingURL=TreeNodeRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeRenderer.js","names":["cloneElement","forwardRef","isValidElement","memo","useCallback","useEffect","useId","useMemo","useRef","useState","Description","IconButton","Spinner","Text","TextBox","DropdownMenu","unstable_Popover","Popover","Tree","useTranslation","TreeActionBase","useTreeNodeRenameContext","checkmarkSvg","dismissSvg","refreshSvg","ComponentPropsWithoutRef","FC","PropsWithRef","ReactNode","RefAttributes","TreeRendererProps","TreeNode","TreeActionBaseAttributes","TreeNodeRendererOwnProps","Pick","node","menuActions","inlineActions","contextMenuActions","StrataKitTreeItemProps","Omit","Item","decorations","TreeNodeRendererProps","StrataKitTreeNodeRenderer","HTMLElement","HierarchyNode","props","forwardedRef","$","_c","expandNode","reloadTree","treeItemProps","translate","renameContext","contextMenuProps","setContextMenuProps","undefined","label","t0","bb0","errors","some","_temp","t1","t2","id","parentNodeId","state","t3","injectActionVariant","inlineActionItems","bb1","menuActionItems","bb2","_temp2","children","length","isExpanded","expanded","renameParameters","cancelRename","t4","commit","t5","labelValidationHint","t6","validate","t7","labelEditor","t8","nodeId","t9","t10","t11","t12","e_1","onContextMenu","e","preventDefault","actions","position","x","clientX","y","clientY","t13","t14","t15","t16","Symbol","for","open","t17","t18","top","left","t19","t20","t21","t22","PlaceholderNode","LabelEditor","initialLabel","onChange","onCancel","inputRef","newLabelValue","setNewLabelValue","hasError","setHasError","handleLabelChange","cancelLabelChange","current","focus","select","canRename","inputId","width","event","target","value","event_0","key","display","variant","filter","action","map","type","e_0","isNodeExpandable"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./TreeNodeRenderer.css\";\n\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n memo,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Description, IconButton, Spinner, Text, TextBox } from \"@stratakit/bricks\";\nimport { DropdownMenu, unstable_Popover as Popover, Tree } from \"@stratakit/structures\";\nimport { useTranslation } from \"../LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\nimport { useTreeNodeRenameContext } from \"./TreeNodeRenameAction.js\";\n\nimport checkmarkSvg from \"@stratakit/icons/checkmark.svg\";\nimport dismissSvg from \"@stratakit/icons/dismiss.svg\";\nimport refreshSvg from \"@stratakit/icons/refresh.svg\";\n\nimport type { ComponentPropsWithoutRef, FC, PropsWithRef, ReactNode, RefAttributes } from \"react\";\nimport type { TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/** @internal */\ninterface TreeNodeRendererOwnProps extends Pick<TreeRendererProps, \"expandNode\" | \"reloadTree\"> {\n /** Node that is rendered. */\n node: TreeNode;\n /**\n * Menu actions for tree item.\n * Must be an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n menuActions?: ReactNode[];\n /**\n * Inline actions for tree item.\n * Must be an array of `<TreeActionBase />` elements.\n * Max 2 items.\n */\n inlineActions?: ReactNode[];\n /**\n * Context menu actions for tree item.\n * Must be an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n contextMenuActions?: ReactNode[];\n}\n\n/** @alpha */\nexport type StrataKitTreeItemProps = Omit<\n ComponentPropsWithoutRef<typeof Tree.Item>,\n \"actions\" | \"inlineActions\" | \"expanded\" | \"onExpandedChange\" | \"icon\" | \"unstable_decorations\" | \"error\"\n> & {\n /**\n * Used to render elements between expander and label.\n * E.g. icons, color picker, etc.\n */\n decorations?: ReactNode;\n};\n\n/** @internal */\nexport type TreeNodeRendererProps = StrataKitTreeItemProps & TreeNodeRendererOwnProps;\n\n/**\n * A component that renders a given `TreeNode` using the `Tree.Item` component from `@stratakit/structures`.\n *\n * @internal\n */\nexport const StrataKitTreeNodeRenderer: FC<PropsWithRef<TreeNodeRendererProps & RefAttributes<HTMLElement>>> = memo(\n forwardRef<HTMLElement, TreeNodeRendererProps>(function HierarchyNode(props, forwardedRef) {\n const {\n node,\n decorations,\n inlineActions,\n menuActions,\n contextMenuActions,\n expandNode,\n reloadTree,\n ...treeItemProps\n } = props;\n const translate = useTranslation();\n const renameContext = useTreeNodeRenameContext();\n const [contextMenuProps, setContextMenuProps] = useState<\n { position: { x: number; y: number }; actions: ReactNode[] } | undefined\n >(undefined);\n\n const label = treeItemProps.label ?? node.label;\n const inlineActionItems = useMemo(() => {\n if (node.errors.some((e) => e.type === \"ChildrenLoad\")) {\n return [\n <TreeActionBase\n key=\"retry\"\n label={translate(\"retry\")}\n onClick={() => reloadTree({ parentNodeId: node.id, state: \"reset\" })}\n visible={true}\n icon={refreshSvg}\n variant=\"inline\"\n />,\n ];\n }\n if (!inlineActions) {\n return undefined;\n }\n return injectActionVariant(inlineActions, \"inline\");\n }, [node, inlineActions, translate, reloadTree]);\n\n const menuActionItems = useMemo(() => {\n if (!menuActions) {\n return undefined;\n }\n return injectActionVariant(menuActions, \"default\");\n }, [menuActions]);\n\n const expanded = useMemo(() => {\n if (node.errors.some((e) => e.type !== \"Unknown\" || !e.isNodeExpandable)) {\n return undefined;\n }\n\n // this is a leaf node\n if (node.children !== true && node.children.length === 0) {\n return undefined;\n }\n\n return node.isExpanded;\n }, [node]);\n\n const { renameParameters, cancelRename } = renameContext ?? {};\n const labelEditor = (\n <LabelEditor\n initialLabel={node.label}\n onChange={renameParameters?.commit}\n onCancel={cancelRename}\n labelValidationHint={renameParameters?.labelValidationHint}\n validate={renameParameters?.validate}\n />\n );\n\n return (\n <>\n <Popover\n content={labelEditor}\n placement=\"bottom\"\n open={renameParameters?.nodeId === node.id}\n setOpen={cancelRename}\n unmountOnHide\n >\n <Tree.Item\n {...treeItemProps}\n ref={forwardedRef}\n label={label}\n expanded={expanded}\n onExpandedChange={useCallback(\n (isExpanded: boolean) => {\n expandNode(node.id, isExpanded);\n },\n [node, expandNode],\n )}\n inlineActions={inlineActionItems}\n actions={menuActionItems}\n unstable_decorations={decorations}\n error={node.errors.length > 0 ? node.errors[0].id : undefined}\n onContextMenu={(e) => {\n if (treeItemProps.onContextMenu) {\n treeItemProps.onContextMenu(e);\n }\n\n if (!contextMenuActions) {\n return;\n }\n\n e.preventDefault();\n const actions = injectActionVariant(contextMenuActions, \"context-menu\");\n if (actions.length === 0) {\n return;\n }\n\n setContextMenuProps({ position: { x: e.clientX, y: e.clientY }, actions });\n }}\n />\n </Popover>\n <DropdownMenu.Provider\n open={contextMenuProps !== undefined}\n setOpen={(open) => {\n if (!open) {\n setContextMenuProps(undefined);\n }\n }}\n key={`${node.id}-${contextMenuProps?.position.x ?? \"\"}-${contextMenuProps?.position.y ?? \"\"}`}\n >\n {contextMenuProps ? (\n <DropdownMenu.Button\n style={{ position: \"fixed\", top: contextMenuProps.position.y, left: contextMenuProps.position.x }}\n render={<div />}\n />\n ) : null}\n {/* `autoFocus` prop is coming from ariakit and is not native HTML `autoFocus` prop. */}\n {/* `focusable` is needed for `autoFocus` to work. StrataKit exposes only `autoFocus` and does not set `focusable` internally. */}\n {/* eslint-disable jsx-a11y/no-autofocus */}\n {/* @ts-expect-error focusable is passed through */}\n <DropdownMenu.Content focusable autoFocus={true}>\n {contextMenuProps?.actions}\n </DropdownMenu.Content>\n </DropdownMenu.Provider>\n </>\n );\n }),\n);\n\nexport const PlaceholderNode: FC<\n PropsWithRef<\n Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\"> & RefAttributes<HTMLElement>\n >\n> = memo(\n forwardRef<HTMLElement, Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\">>(\n function PlaceholderNode({ ...props }, forwardedRef) {\n const translate = useTranslation();\n return (\n <Tree.Item\n {...props}\n ref={forwardedRef}\n label={translate(\"loading\")}\n unstable_decorations={<Spinner size={\"small\"} title={translate(\"loading\")} />}\n />\n );\n },\n ),\n);\n\nfunction LabelEditor({\n initialLabel,\n labelValidationHint,\n onChange,\n onCancel,\n validate,\n}: {\n initialLabel: string;\n labelValidationHint?: string;\n onChange?: (newLabel: string) => void;\n onCancel?: () => void;\n validate?: (newLabel: string) => boolean;\n}) {\n const translate = useTranslation();\n const inputRef = useRef<HTMLInputElement>(null);\n const [newLabelValue, setNewLabelValue] = useState(initialLabel);\n const [hasError, setHasError] = useState<boolean>(false);\n const handleLabelChange = () => {\n if (validate && !validate(newLabelValue)) {\n setHasError(true);\n return;\n }\n\n if (initialLabel !== newLabelValue) {\n onChange?.(newLabelValue);\n return;\n }\n onCancel?.();\n };\n\n const cancelLabelChange = () => {\n setNewLabelValue(initialLabel);\n onCancel?.();\n };\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n inputRef.current.select();\n }\n }, []);\n\n const canRename = newLabelValue && newLabelValue !== initialLabel && !hasError;\n const inputId = useId();\n\n return (\n <div key={initialLabel} className=\"phr-node-label-editor\">\n <div className=\"phr-node-label-editor-input-row\">\n <TextBox.Root style={{ width: \"100%\" }} className={hasError ? \"with-error\" : undefined}>\n <TextBox.Input\n id={inputId}\n ref={inputRef}\n aria-label={translate(\"newLabel\")}\n value={newLabelValue}\n onChange={(event) => {\n setNewLabelValue(event.target.value);\n setHasError(false);\n }}\n onKeyUp={(event) => {\n if (event.key === \"Enter\") {\n handleLabelChange();\n } else if (event.key === \"Escape\") {\n cancelLabelChange();\n }\n }}\n />\n </TextBox.Root>\n <IconButton icon={dismissSvg} label={translate(\"cancel\")} onClick={cancelLabelChange} />\n <IconButton\n icon={checkmarkSvg}\n label={translate(\"confirm\")}\n onClick={handleLabelChange}\n disabled={!canRename}\n />\n </div>\n {labelValidationHint !== undefined ? (\n <Description id={inputId} tone={hasError ? \"critical\" : \"neutral\"} style={{ display: \"flex\" }}>\n <Text variant=\"caption-lg\">{labelValidationHint}</Text>\n </Description>\n ) : undefined}\n </div>\n );\n}\n\nfunction injectActionVariant(actions: ReactNode[], variant: TreeActionBaseAttributes[\"variant\"]) {\n return actions\n .filter((action) => isValidElement<TreeActionBaseAttributes>(action))\n .map((action) => cloneElement<TreeActionBaseAttributes>(action, { variant }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4EA,MAAa4C,4BAAkGzC,KAC7GF,WAA+C,SAAA6C,cAAAC,OAAAC,cAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAZ;CAAA,IAAAI;CAAA,IAAAS;CAAA,IAAAd;CAAA,IAAAD;CAAA,IAAAD;CAAA,IAAAiB;CAAA,IAAAC;AAAA,KAAAJ,EAAA,OAAAF,OAAA;AAC7C,GAAA,CAAAZ,MAAAO,aAAAL,eAAAD,aAAAE,oBAAAa,YAAAC,eAAAC,iBASIN;AAAME,IAAA,KAAAF;AAAAE,IAAA,KAAAX;AAAAW,IAAA,KAAAP;AAAAO,IAAA,KAAAE;AAAAF,IAAA,KAAAZ;AAAAY,IAAA,KAAAb;AAAAa,IAAA,KAAAd;AAAAc,IAAA,KAAAG;AAAAH,IAAA,KAAAI;QAAA;AAAAf,uBAAAW,EAAA;AAAAP,gBAAAO,EAAA;AAAAE,eAAAF,EAAA;AAAAZ,kBAAAY,EAAA;AAAAb,gBAAAa,EAAA;AAAAd,SAAAc,EAAA;AAAAG,eAAAH,EAAA;AAAAI,kBAAAJ,EAAA;;CACV,MAAAK,YAAkBnC,gBAAgB;CA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AD;GAAiBgF,IAAAA;GAAe,MAAAR,WAAA,aAAA;GAA0C,OAAA,EAAAe,SAAW,QAAO;aAC1F,oBAAC,MAAD;IAAc,SAAA;cAAc3D;IAC9B,CAAA;GACW,CAAA,GAJZ5B,KAAAA;AAIYT,IAAA,MAAAiF;AAAAjF,IAAA,MAAAyF;AAAAzF,IAAA,MAAAqC;AAAArC,IAAA,MAAAkE;OAAAA,OAAAlE,EAAA;CAAA,IAAAqE;AAAA,KAAArE,EAAA,QAAA2E,gBAAA3E,EAAA,QAAAiE,OAAAjE,EAAA,QAAAkE,KAAA;AAjCfG,QAAA,qBAAA,OAAA;GAAkC,WAAA;aAAlC,CACEJ,KA4BCC,IAKG;KAlCIS,aAkCJ;AAAA3E,IAAA,MAAA2E;AAAA3E,IAAA,MAAAiE;AAAAjE,IAAA,MAAAkE;AAAAlE,IAAA,MAAAqE;OAAAA,OAAArE,EAAA;AAAA,QAlCNqE;;AAsCJ,SAAS/C,oBAAoB8B,SAAsB6C,SAA8C;AAC/F,QAAO7C,QACJ8C,QAAQC,WAAWlJ,eAAyCkJ,OAAO,CAAC,CACpEC,KAAKD,WAAWpJ,aAAuCoJ,QAAQ,EAAEF,SAAS,CAAC,CAAC;;AAtPhC,SAAAlF,MAAAmC,GAAA;AAAA,QAmBfA,EAACmD,SAAU;;AAnBI,SAAA1E,OAAA2E,KAAA;AAAA,QA6CfpD,IAACmD,SAAU,aAAX,CAAyBnD,IAACqD"}
@@ -0,0 +1,75 @@
1
+ import { TreeNode } from "../TreeNode.js";
2
+ import { TreeRendererProps } from "../Renderers.js";
3
+ import { SelectionMode } from "../UseSelectionHandler.js";
4
+ import { TreeNodeEditingProps } from "./TreeNodeRenameAction.js";
5
+ import { TreeErrorRendererProps } from "./TreeErrorRenderer.js";
6
+ import { StrataKitTreeItemProps } from "./TreeNodeRenderer.js";
7
+ import { ComponentProps, FC, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from "react";
8
+ import { Tree } from "@stratakit/structures";
9
+
10
+ //#region src/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts
11
+ /** @alpha */
12
+ interface TreeRendererOwnProps {
13
+ id?: string;
14
+ /**
15
+ * A user friendly display label of the tree. Should be unique within the consuming application,
16
+ * as it's used for accessibility purposes.
17
+ */
18
+ treeLabel: string;
19
+ /** Active selection mode used by the tree. Defaults to `"single"`. */
20
+ selectionMode?: SelectionMode;
21
+ /** A render function for errors' display component. Defaults to `<TreeErrorRenderer />`. */
22
+ errorRenderer?: (props: TreeErrorRendererProps) => ReactElement;
23
+ /** Props that defines if current node supports editing. */
24
+ getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined;
25
+ /** Custom props for the root Tree component. */
26
+ treeRootProps?: Partial<Omit<ComponentProps<typeof Tree.Root>, "style">>;
27
+ /** A callback that returns tree item props for specific node. */
28
+ getTreeItemProps?: (node: TreeNode) => Partial<Omit<StrataKitTreeItemProps, "selected" | "aria-level" | "aria-posinset" | "aria-setsize">>;
29
+ /**
30
+ * Callback that returns menu actions for tree item.
31
+ * Must return an array of `<TreeActionBase />` or `<Divider />` elements.
32
+ */
33
+ getMenuActions?: (props: {
34
+ targetNode: TreeNode;
35
+ selectedNodes: TreeNode[];
36
+ }) => ReactNode[];
37
+ /**
38
+ * Callback that returns inline actions for tree item.
39
+ * Must return an array of `<TreeActionBase />` elements.
40
+ * Max 2 items.
41
+ */
42
+ getInlineActions?: (props: {
43
+ targetNode: TreeNode;
44
+ selectedNodes: TreeNode[];
45
+ }) => ReactNode[];
46
+ /**
47
+ * Callback that returns actions for tree item context menu.
48
+ * Must return an array of `<TreeActionBase />` or `<Divider />` elements.
49
+ */
50
+ getContextMenuActions?: (props: {
51
+ targetNode: TreeNode;
52
+ selectedNodes: TreeNode[];
53
+ }) => ReactNode[];
54
+ }
55
+ /** @alpha */
56
+ interface StrataKitTreeRendererAttributes {
57
+ /**
58
+ * Opens rename mode for the first node that matches the given predicate. Node must be already loaded in the tree.
59
+ * If the node is not visible (because its parent is collapsed), all parents will be expanded to make it visible and node will be scrolled into view.
60
+ *
61
+ * Returns "node-not-found" if no node matches the predicate, "success" if rename was initiated.
62
+ */
63
+ renameNode: (nodePredicate: (node: TreeNode) => boolean) => "node-not-found" | "success";
64
+ }
65
+ /** @alpha */
66
+ type StrataKitTreeRendererProps = TreeRendererProps & Pick<TreeErrorRendererProps, "filterHierarchyLevel"> & TreeRendererOwnProps;
67
+ /**
68
+ * A component that renders a tree using the `Tree` component from `@stratakit/structures`.
69
+ *
70
+ * @alpha
71
+ */
72
+ declare const StrataKitTreeRenderer: FC<PropsWithoutRef<StrataKitTreeRendererProps> & RefAttributes<StrataKitTreeRendererAttributes>>;
73
+ //#endregion
74
+ export { StrataKitTreeRenderer, StrataKitTreeRendererAttributes };
75
+ //# sourceMappingURL=TreeRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeRenderer.tsx"],"mappings":";;;;;;;;;;;UAyBU,oBAAA;EACR,EAAA;EAD4B;;;;EAM5B,SAAA;EAMyB;EAJzB,aAAA,GAAgB,aAAA;EAOmC;EALnD,aAAA,IAAiB,KAAA,EAAO,sBAAA,KAA2B,YAAA;EAK3B;EAHxB,eAAA,IAAmB,IAAA,EAAM,QAAA,KAAa,oBAAA;EAO9B;EAJR,aAAA,GAAgB,OAAA,CAAQ,IAAA,CAAK,cAAA,QAAsB,IAAA,CAAK,IAAA;EAK3C;EAFb,gBAAA,IACE,IAAA,EAAM,QAAA,KACH,OAAA,CAAQ,IAAA,CAAK,sBAAA;EAMqB;;;;EAAvC,cAAA,IAAkB,KAAA;IAAS,UAAA,EAAY,QAAA;IAAU,aAAA,EAAe,QAAA;EAAA,MAAiB,SAAA;EAWO;;;;;EALxF,gBAAA,IAAoB,KAAA;IAAS,UAAA,EAAY,QAAA;IAAU,aAAA,EAAe,QAAA;EAAA,MAAiB,SAAA;EAtBlE;;;;EA2BjB,qBAAA,IAAyB,KAAA;IAAS,UAAA,EAAY,QAAA;IAAU,aAAA,EAAe,QAAA;EAAA,MAAiB,SAAA;AAAA;;UAIzE,+BAAA;EA1ByC;;;;;;EAiCxD,UAAA,GAAa,aAAA,GAAgB,IAAA,EAAM,QAAA;AAAA;;KAIhC,0BAAA,GAA6B,iBAAA,GAChC,IAAA,CAAK,sBAAA,4BACL,oBAAA;;;;;;cAOW,qBAAA,EAAuB,EAAA,CAClC,eAAA,CAAgB,0BAAA,IAA8B,aAAA,CAAc,+BAAA"}