@itwin/presentation-hierarchies-react 2.0.0-alpha.5 → 2.0.0-alpha.51

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 (121) hide show
  1. package/CHANGELOG.md +902 -7
  2. package/README.md +28 -70
  3. package/lib/esm/presentation-hierarchies-react/Renderers.d.ts +85 -0
  4. package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
  5. package/lib/esm/presentation-hierarchies-react/Renderers.js +6 -0
  6. package/lib/esm/presentation-hierarchies-react/Renderers.js.map +1 -0
  7. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +28 -29
  8. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
  9. package/lib/esm/presentation-hierarchies-react/TreeNode.js +1 -7
  10. package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +1 -1
  11. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts +7 -5
  12. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -1
  13. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +6 -6
  14. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
  15. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts +24 -0
  16. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
  17. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js +53 -0
  18. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
  19. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +12 -10
  20. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -1
  21. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +7 -22
  22. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
  23. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +33 -71
  24. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
  25. package/lib/esm/presentation-hierarchies-react/UseTree.js +63 -64
  26. package/lib/esm/presentation-hierarchies-react/UseTree.js.map +1 -1
  27. package/lib/esm/presentation-hierarchies-react/Utils.d.ts +8 -0
  28. package/lib/esm/presentation-hierarchies-react/Utils.d.ts.map +1 -0
  29. package/lib/esm/presentation-hierarchies-react/Utils.js +39 -0
  30. package/lib/esm/presentation-hierarchies-react/Utils.js.map +1 -0
  31. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +2 -2
  32. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +1 -1
  33. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +31 -16
  34. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
  35. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +24 -6
  36. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +1 -1
  37. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +29 -33
  38. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
  39. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +6 -29
  40. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +1 -1
  41. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +31 -27
  42. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
  43. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +23 -9
  44. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
  45. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +16 -29
  46. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
  47. package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +1 -1
  48. package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +1 -1
  49. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +27 -0
  50. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
  51. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +74 -0
  52. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
  53. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts +48 -0
  54. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -0
  55. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js +73 -0
  56. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -0
  57. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +133 -0
  58. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -0
  59. package/lib/esm/presentation-hierarchies-react/{itwinui → stratakit}/LocalizationContext.js +17 -5
  60. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -0
  61. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +16 -0
  62. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
  63. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +42 -0
  64. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
  65. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts +45 -0
  66. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
  67. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js +36 -0
  68. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
  69. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +30 -0
  70. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
  71. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +30 -0
  72. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
  73. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts +20 -0
  74. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -0
  75. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js +29 -0
  76. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -0
  77. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts +57 -0
  78. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -0
  79. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js +71 -0
  80. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -0
  81. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.css +25 -0
  82. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +46 -0
  83. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
  84. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +132 -0
  85. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
  86. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +75 -0
  87. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
  88. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +193 -0
  89. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
  90. package/lib/esm/presentation-hierarchies-react.d.ts +14 -10
  91. package/lib/esm/presentation-hierarchies-react.d.ts.map +1 -1
  92. package/lib/esm/presentation-hierarchies-react.js +11 -9
  93. package/lib/esm/presentation-hierarchies-react.js.map +1 -1
  94. package/package.json +55 -47
  95. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts +0 -15
  96. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts.map +0 -1
  97. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js +0 -22
  98. package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js.map +0 -1
  99. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts +0 -21
  100. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts.map +0 -1
  101. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js +0 -30
  102. package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js.map +0 -1
  103. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts +0 -73
  104. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts.map +0 -1
  105. package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js.map +0 -1
  106. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts +0 -25
  107. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
  108. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -40
  109. package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
  110. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +0 -23
  111. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts.map +0 -1
  112. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js +0 -72
  113. package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js.map +0 -1
  114. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts +0 -40
  115. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +0 -1
  116. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +0 -80
  117. package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js.map +0 -1
  118. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts +0 -30
  119. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts.map +0 -1
  120. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js +0 -48
  121. package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeErrorRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAgB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAqB,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD;;;;GAIG;AACH,UAAU,yBAAyB;IACjC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,UAAU,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;IAC7C,uIAAuI;IACvI,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC;CAC/D;AAED,aAAa;AACb,MAAM,MAAM,sBAAsB,GAAG,yBAAyB,GAAG,IAAI,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;AAE3G;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,sBAAsB,EAAE,EAAE,sBAAsB,2CAyB1H"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ import { cloneElement } from "react";
7
+ import { unstable_ErrorRegion as ErrorRegion } from "@stratakit/structures";
8
+ import { ErrorItemRenderer } from "./ErrorItemRenderer.js";
9
+ import { useLocalizationContext } from "./LocalizationContext.js";
10
+ /**
11
+ * A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@itwin/itwinui-react`.
12
+ * As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorList` hook.
13
+ *
14
+ * @alpha
15
+ */
16
+ export function TreeErrorRenderer({ treeLabel, errorNodes, renderError, ...errorItemRendererProps }) {
17
+ const { localizedStrings } = useLocalizationContext();
18
+ const errorItems = errorNodes.map((errorNode) => {
19
+ const errorRendererProps = {
20
+ errorNode,
21
+ ...errorItemRendererProps,
22
+ };
23
+ if (renderError) {
24
+ return cloneElement(renderError(errorRendererProps), { key: errorNode.id });
25
+ }
26
+ return _jsx(ErrorItemRenderer, { ...errorRendererProps }, errorNode.id);
27
+ });
28
+ return (_jsx(ErrorRegion.Root, { style: { width: "100%" }, "aria-label": localizedStrings.issuesForTree.replace("{{tree_label}}", treeLabel), label: errorNodes.length === 0 ? localizedStrings.noIssuesFound : localizedStrings.issuesFound.replace("{{number_of_issues}}", errorNodes.length.toString()), items: errorItems }));
29
+ }
30
+ //# sourceMappingURL=TreeErrorRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeErrorRenderer.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,YAAY,EAAgB,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,oBAAoB,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAA0B,MAAM,wBAAwB,CAAC;AAEnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAsBlE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,sBAAsB,EAA0B;IACzH,MAAM,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACtD,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAC9C,MAAM,kBAAkB,GAA2B;YACjD,SAAS;YACT,GAAG,sBAAsB;SAC1B,CAAC;QAEF,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,YAAY,CAAC,WAAW,CAAC,kBAAkB,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO,KAAC,iBAAiB,OAAwB,kBAAkB,IAApC,SAAS,CAAC,EAAE,CAA4B,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,WAAW,CAAC,IAAI,IACf,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,gBACZ,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAC/E,KAAK,EACH,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAEvJ,KAAK,EAAE,UAAU,GACjB,CACH,CAAC;AACJ,CAAC","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 { cloneElement, ReactElement } from \"react\";\nimport { unstable_ErrorRegion as ErrorRegion } from \"@stratakit/structures\";\nimport { ErrorItemRenderer, ErrorItemRendererProps } from \"./ErrorItemRenderer.js\";\nimport { useErrorNodes } from \"./FlatTreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\n\n/**\n * Interface containing building blocks for `TreeErrorRenderer`.\n *\n * @alpha\n */\ninterface TreeErrorRendererOwnProps {\n /**\n * A user friendly display label of the tree. Should be unique within the consuming application,\n * as it's used for creating a unique accessible label for the error region.\n */\n treeLabel: string;\n /** List of error nodes to render errors for. */\n errorNodes: ReturnType<typeof useErrorNodes>;\n /** Callback to render custom error messages. Component should be wrapped in `ErrorRegion.Item` from `@itwin/itwinui-react` package. */\n renderError?: (props: ErrorItemRendererProps) => ReactElement;\n}\n\n/** @alpha */\nexport type TreeErrorRendererProps = TreeErrorRendererOwnProps & Omit<ErrorItemRendererProps, \"errorNode\">;\n\n/**\n * A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@itwin/itwinui-react`.\n * As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorList` hook.\n *\n * @alpha\n */\nexport function TreeErrorRenderer({ treeLabel, errorNodes, renderError, ...errorItemRendererProps }: TreeErrorRendererProps) {\n const { localizedStrings } = useLocalizationContext();\n const errorItems = errorNodes.map((errorNode) => {\n const errorRendererProps: ErrorItemRendererProps = {\n errorNode,\n ...errorItemRendererProps,\n };\n\n if (renderError) {\n return cloneElement(renderError(errorRendererProps), { key: errorNode.id });\n }\n\n return <ErrorItemRenderer key={errorNode.id} {...errorRendererProps} />;\n });\n\n return (\n <ErrorRegion.Root\n style={{ width: \"100%\" }}\n aria-label={localizedStrings.issuesForTree.replace(\"{{tree_label}}\", treeLabel)}\n label={\n errorNodes.length === 0 ? localizedStrings.noIssuesFound : localizedStrings.issuesFound.replace(\"{{number_of_issues}}\", errorNodes.length.toString())\n }\n items={errorItems}\n />\n );\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { HierarchyLevelDetails, TreeRendererProps } from "../Renderers.js";
2
+ import { TreeNode } from "../TreeNode.js";
3
+ import { TreeActionBaseAttributes } from "./TreeAction.js";
4
+ /**
5
+ * React component that renders a filter action for a tree item.
6
+ *
7
+ * The action calls the `onFilter` callback prop when clicked.
8
+ *
9
+ * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action
10
+ * to tree items.
11
+ *
12
+ * @alpha
13
+ */
14
+ export declare const TreeNodeFilterAction: import("react").NamedExoticComponent<{
15
+ /** Action to perform when the filter button is clicked for this node. */
16
+ onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
17
+ } & TreeActionBaseAttributes & Pick<TreeRendererProps, "getHierarchyLevelDetails"> & {
18
+ node: TreeNode;
19
+ }>;
20
+ //# sourceMappingURL=TreeNodeFilterAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeFilterAction.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAkB,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAS3E;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;IAf/B,yEAAyE;eAC9D,CAAC,qBAAqB,EAAE,qBAAqB,KAAK,IAAI;;UAmB5B,QAAQ;EAoB7C,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ import { memo, useCallback } from "react";
7
+ import filterSvg from "@stratakit/icons/filter.svg";
8
+ import { useLocalizationContext } from "./LocalizationContext.js";
9
+ import { TreeActionBase } from "./TreeAction.js";
10
+ /**
11
+ * React component that renders a filter action for a tree item.
12
+ *
13
+ * The action calls the `onFilter` callback prop when clicked.
14
+ *
15
+ * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action
16
+ * to tree items.
17
+ *
18
+ * @alpha
19
+ */
20
+ export const TreeNodeFilterAction = memo(function TreeNodeFilterAction({ node, onFilter, getHierarchyLevelDetails, ...actionAttributes }) {
21
+ const { localizedStrings } = useLocalizationContext();
22
+ const { filterHierarchyLevel, filterHierarchyLevelActiveDescription } = localizedStrings;
23
+ const handleClick = useCallback(() => {
24
+ const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.id);
25
+ hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);
26
+ }, [node, getHierarchyLevelDetails, onFilter]);
27
+ return (_jsx(TreeActionBase, { ...actionAttributes, label: filterHierarchyLevel, onClick: handleClick, icon: filterSvg, visible: node.isFiltered ? true : undefined, dot: node.isFiltered ? filterHierarchyLevelActiveDescription : undefined, hide: !onFilter || !node.isFilterable }));
28
+ });
29
+ //# sourceMappingURL=TreeNodeFilterAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeFilterAction.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAGpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAA4B,MAAM,iBAAiB,CAAC;AAS3E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,oBAAoB,CAAC,EACrE,IAAI,EACJ,QAAQ,EACR,wBAAwB,EACxB,GAAG,gBAAgB,EAC4B;IAC/C,MAAM,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACtD,MAAM,EAAE,oBAAoB,EAAE,qCAAqC,EAAE,GAAG,gBAAgB,CAAC;IAEzF,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClE,qBAAqB,IAAI,QAAQ,EAAE,CAAC,qBAAqB,CAAC,CAAC;IAC7D,CAAC,EAAE,CAAC,IAAI,EAAE,wBAAwB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE/C,OAAO,CACL,KAAC,cAAc,OACT,gBAAgB,EACpB,KAAK,EAAE,oBAAoB,EAC3B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAC3C,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,SAAS,EACxE,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY,GACrC,CACH,CAAC;AACJ,CAAC,CAAC,CAAC","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 { memo, useCallback } from \"react\";\nimport filterSvg from \"@stratakit/icons/filter.svg\";\nimport { HierarchyLevelDetails, TreeRendererProps } from \"../Renderers.js\";\nimport { TreeNode } from \"../TreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeActionBase, TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/** @alpha */\ntype TreeNodeFilterActionProps = {\n /** Action to perform when the filter button is clicked for this node. */\n onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;\n} & TreeActionBaseAttributes &\n Pick<TreeRendererProps, \"getHierarchyLevelDetails\">;\n\n/**\n * React component that renders a filter action for a tree item.\n *\n * The action calls the `onFilter` callback prop when clicked.\n *\n * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action\n * to tree items.\n *\n * @alpha\n */\nexport const TreeNodeFilterAction = memo(function TreeNodeFilterAction({\n node,\n onFilter,\n getHierarchyLevelDetails,\n ...actionAttributes\n}: TreeNodeFilterActionProps & { node: TreeNode }) {\n const { localizedStrings } = useLocalizationContext();\n const { filterHierarchyLevel, filterHierarchyLevelActiveDescription } = localizedStrings;\n\n const handleClick = useCallback(() => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.id);\n hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);\n }, [node, getHierarchyLevelDetails, onFilter]);\n\n return (\n <TreeActionBase\n {...actionAttributes}\n label={filterHierarchyLevel}\n onClick={handleClick}\n icon={filterSvg}\n visible={node.isFiltered ? true : undefined}\n dot={node.isFiltered ? filterHierarchyLevelActiveDescription : undefined}\n hide={!onFilter || !node.isFilterable}\n />\n );\n});\n"]}
@@ -0,0 +1,57 @@
1
+ import { PropsWithChildren } from "react";
2
+ import { TreeNode } from "../TreeNode.js";
3
+ import { TreeActionBaseAttributes } from "./TreeAction.js";
4
+ /**
5
+ * React component that renders a rename action for a tree item.
6
+ *
7
+ * The tree component must have `getEditingProps.onLabelChanged` prop set to enable renaming functionality. When
8
+ * rename is completed, the `onLabelChanged` function is called to make the actual data update.
9
+ *
10
+ * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action
11
+ * to tree items.
12
+ *
13
+ * @alpha
14
+ */
15
+ export declare const TreeNodeRenameAction: import("react").NamedExoticComponent<TreeActionBaseAttributes & {
16
+ node: TreeNode;
17
+ }>;
18
+ /** @alpha */
19
+ export interface TreeNodeEditingProps {
20
+ /**
21
+ * A callback that is invoked when node label is changed. Should be used together
22
+ * with `<TreeNodeRenameAction />` to enter label editing mode.
23
+ */
24
+ onLabelChanged: (newLabel: string) => void;
25
+ labelValidationHint?: string;
26
+ validate?: (newLabel: string) => boolean;
27
+ }
28
+ /** @internal */
29
+ export interface RenameParameters {
30
+ nodeId: string;
31
+ commit: (newLabel: string) => void;
32
+ labelValidationHint?: string;
33
+ validate?: (newLabel: string) => boolean;
34
+ }
35
+ interface TreeNodeRenameContext {
36
+ renameParameters?: RenameParameters;
37
+ startRename: (node: TreeNode) => void;
38
+ canRename: (node: TreeNode) => boolean;
39
+ cancelRename: () => void;
40
+ }
41
+ /** @internal */
42
+ export declare const useTreeNodeRenameContext: () => TreeNodeRenameContext | undefined;
43
+ /** @internal */
44
+ export declare function TreeNodeRenameContextProvider({ value, children }: PropsWithChildren<{
45
+ value: TreeNodeRenameContext;
46
+ }>): import("react/jsx-runtime").JSX.Element;
47
+ /** @internal */
48
+ export declare function useTreeNodeRenameContextValue({ getEditingProps }: {
49
+ getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined;
50
+ }): {
51
+ renameParameters: RenameParameters | undefined;
52
+ cancelRename: () => void;
53
+ startRename: (node: TreeNode) => void;
54
+ canRename: (node: TreeNode) => boolean;
55
+ };
56
+ export {};
57
+ //# sourceMappingURL=TreeNodeRenameAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeRenameAction.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAuB,iBAAiB,EAA8C,MAAM,OAAO,CAAC;AAE3G,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAkB,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB;UAAwG,QAAQ;EAY/I,CAAC;AAEH,aAAa;AACb,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1C;AAED,gBAAgB;AAChB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1C;AAED,UAAU,qBAAqB;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACtC,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC;IACvC,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAID,gBAAgB;AAChB,eAAO,MAAM,wBAAwB,yCAEpC,CAAC;AAEF,gBAAgB;AAChB,wBAAgB,6BAA6B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC;IAAE,KAAK,EAAE,qBAAqB,CAAA;CAAE,CAAC,2CAErH;AAED,gBAAgB;AAChB,wBAAgB,6BAA6B,CAAC,EAAE,eAAe,EAAE,EAAE;IAAE,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,oBAAoB,GAAG,SAAS,CAAA;CAAE;;;wBAIlI,QAAQ;sBAsBR,QAAQ;EAelB"}
@@ -0,0 +1,71 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ import { createContext, memo, useCallback, useContext, useMemo, useState } from "react";
7
+ import renameSvg from "@stratakit/icons/rename.svg";
8
+ import { useLocalizationContext } from "./LocalizationContext.js";
9
+ import { TreeActionBase } from "./TreeAction.js";
10
+ /**
11
+ * React component that renders a rename action for a tree item.
12
+ *
13
+ * The tree component must have `getEditingProps.onLabelChanged` prop set to enable renaming functionality. When
14
+ * rename is completed, the `onLabelChanged` function is called to make the actual data update.
15
+ *
16
+ * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action
17
+ * to tree items.
18
+ *
19
+ * @alpha
20
+ */
21
+ export const TreeNodeRenameAction = memo(function TreeNodeRenameAction({ node, ...actionAttributes }) {
22
+ const { localizedStrings } = useLocalizationContext();
23
+ const context = useTreeNodeRenameContext();
24
+ const { rename } = localizedStrings;
25
+ const canRename = context?.canRename(node) ?? false;
26
+ const startRename = context?.startRename;
27
+ const handleClick = useCallback(() => {
28
+ startRename?.(node);
29
+ }, [startRename, node]);
30
+ return _jsx(TreeActionBase, { ...actionAttributes, label: rename, onClick: handleClick, icon: renameSvg, hide: !canRename });
31
+ });
32
+ const treeNodeRenameContext = createContext(undefined);
33
+ /** @internal */
34
+ export const useTreeNodeRenameContext = () => {
35
+ return useContext(treeNodeRenameContext);
36
+ };
37
+ /** @internal */
38
+ export function TreeNodeRenameContextProvider({ value, children }) {
39
+ return _jsx(treeNodeRenameContext.Provider, { value: value, children: children });
40
+ }
41
+ /** @internal */
42
+ export function useTreeNodeRenameContextValue({ getEditingProps }) {
43
+ const [renameParameters, setRenameParameters] = useState(undefined);
44
+ const startRename = useCallback((node) => {
45
+ const { onLabelChanged, labelValidationHint, validate } = getEditingProps?.(node) ?? {};
46
+ if (onLabelChanged) {
47
+ setRenameParameters({
48
+ nodeId: node.id,
49
+ commit: (newLabel) => {
50
+ onLabelChanged(newLabel);
51
+ setRenameParameters(undefined);
52
+ },
53
+ labelValidationHint,
54
+ validate,
55
+ });
56
+ }
57
+ }, [getEditingProps]);
58
+ const cancelRename = useCallback(() => {
59
+ setRenameParameters(undefined);
60
+ }, []);
61
+ const canRename = useCallback((node) => {
62
+ return getEditingProps?.(node)?.onLabelChanged !== undefined;
63
+ }, [getEditingProps]);
64
+ return useMemo(() => ({
65
+ renameParameters,
66
+ cancelRename,
67
+ startRename,
68
+ canRename,
69
+ }), [renameParameters, canRename, startRename, cancelRename]);
70
+ }
71
+ //# sourceMappingURL=TreeNodeRenameAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeRenameAction.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAE,IAAI,EAAqB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3G,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAA4B,MAAM,iBAAiB,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,oBAAoB,CAAC,EAAE,IAAI,EAAE,GAAG,gBAAgB,EAAiD;IACjJ,MAAM,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACtD,MAAM,OAAO,GAAG,wBAAwB,EAAE,CAAC;IAC3C,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC;IAEpC,MAAM,SAAS,GAAG,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;IACpD,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,CAAC;IACzC,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;IAExB,OAAO,KAAC,cAAc,OAAK,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO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AAE,CAAC,CAAC;IAEP,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,IAAc,EAAE,EAAE;QACjB,OAAO,eAAe,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,KAAK,SAAS,CAAC;IAC/D,CAAC,EACD,CAAC,eAAe,CAAC,CAClB,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,gBAAgB;QAChB,YAAY;QACZ,WAAW;QACX,SAAS;KACV,CAAC,EACF,CAAC,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CACzD,CAAC;AACJ,CAAC","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 { createContext, memo, PropsWithChildren, useCallback, useContext, useMemo, useState } from \"react\";\nimport renameSvg from \"@stratakit/icons/rename.svg\";\nimport { TreeNode } from \"../TreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeActionBase, TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/**\n * React component that renders a rename action for a tree item.\n *\n * The tree component must have `getEditingProps.onLabelChanged` prop set to enable renaming functionality. When\n * rename is completed, the `onLabelChanged` function is called to make the actual data update.\n *\n * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action\n * to tree items.\n *\n * @alpha\n */\nexport const TreeNodeRenameAction = memo(function TreeNodeRenameAction({ node, ...actionAttributes }: TreeActionBaseAttributes & { node: TreeNode }) {\n const { localizedStrings } = useLocalizationContext();\n const context = useTreeNodeRenameContext();\n const { rename } = localizedStrings;\n\n const canRename = context?.canRename(node) ?? false;\n const startRename = context?.startRename;\n const handleClick = useCallback(() => {\n startRename?.(node);\n }, [startRename, node]);\n\n return <TreeActionBase {...actionAttributes} label={rename} onClick={handleClick} icon={renameSvg} hide={!canRename} />;\n});\n\n/** @alpha */\nexport interface TreeNodeEditingProps {\n /**\n * A callback that is invoked when node label is changed. Should be used together\n * with `<TreeNodeRenameAction />` to enter label editing mode.\n */\n onLabelChanged: (newLabel: string) => void;\n labelValidationHint?: string;\n validate?: (newLabel: string) => boolean;\n}\n\n/** @internal */\nexport interface RenameParameters {\n nodeId: string;\n commit: (newLabel: string) => void;\n labelValidationHint?: string;\n validate?: (newLabel: string) => boolean;\n}\n\ninterface TreeNodeRenameContext {\n renameParameters?: RenameParameters;\n startRename: (node: TreeNode) => void;\n canRename: (node: TreeNode) => boolean;\n cancelRename: () => void;\n}\n\nconst treeNodeRenameContext = createContext<TreeNodeRenameContext | undefined>(undefined);\n\n/** @internal */\nexport const useTreeNodeRenameContext = () => {\n return useContext(treeNodeRenameContext);\n};\n\n/** @internal */\nexport function TreeNodeRenameContextProvider({ value, children }: PropsWithChildren<{ value: TreeNodeRenameContext }>) {\n return <treeNodeRenameContext.Provider value={value}>{children}</treeNodeRenameContext.Provider>;\n}\n\n/** @internal */\nexport function useTreeNodeRenameContextValue({ getEditingProps }: { getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined }) {\n const [renameParameters, setRenameParameters] = useState<RenameParameters | undefined>(undefined);\n\n const startRename = useCallback(\n (node: TreeNode) => {\n const { onLabelChanged, labelValidationHint, validate } = getEditingProps?.(node) ?? {};\n if (onLabelChanged) {\n setRenameParameters({\n nodeId: node.id,\n commit: (newLabel) => {\n onLabelChanged(newLabel);\n setRenameParameters(undefined);\n },\n labelValidationHint,\n validate,\n });\n }\n },\n [getEditingProps],\n );\n\n const cancelRename = useCallback(() => {\n setRenameParameters(undefined);\n }, []);\n\n const canRename = useCallback(\n (node: TreeNode) => {\n return getEditingProps?.(node)?.onLabelChanged !== undefined;\n },\n [getEditingProps],\n );\n\n return useMemo(\n () => ({\n renameParameters,\n cancelRename,\n startRename,\n canRename,\n }),\n [renameParameters, canRename, startRename, cancelRename],\n );\n}\n"]}
@@ -0,0 +1,25 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ .phr-node-label-editor {
7
+ padding: var(--stratakit-space-x1);
8
+ width: 300px;
9
+ display: grid;
10
+ gap: var(--stratakit-space-x1);
11
+ grid-template-rows: auto auto;
12
+
13
+ .phr-node-label-editor-input-row {
14
+ display: grid;
15
+ gap: var(--stratakit-space-x1);
16
+ grid-template-columns: 1fr auto auto;
17
+
18
+ .with-error {
19
+ outline-color: var(--stratakit-color-border-critical-base);
20
+ &::before {
21
+ border-color: var(--stratakit-color-border-critical-base);
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,46 @@
1
+ import "./TreeNodeRenderer.css";
2
+ import { ComponentPropsWithoutRef, FC, PropsWithRef, ReactNode, RefAttributes } from "react";
3
+ import { Tree } from "@stratakit/structures";
4
+ import { TreeRendererProps } from "../Renderers.js";
5
+ import { TreeNode } from "../TreeNode.js";
6
+ /** @internal */
7
+ interface TreeNodeRendererOwnProps extends Pick<TreeRendererProps, "expandNode" | "reloadTree"> {
8
+ /** Node that is rendered. */
9
+ node: TreeNode;
10
+ /**
11
+ * Menu actions for tree item.
12
+ * Must be an array of `<TreeActionBase />` or `<Divider />` elements.
13
+ */
14
+ menuActions?: ReactNode[];
15
+ /**
16
+ * Inline actions for tree item.
17
+ * Must be an array of `<TreeActionBase />` elements.
18
+ * Max 2 items.
19
+ */
20
+ inlineActions?: ReactNode[];
21
+ /**
22
+ * Context menu actions for tree item.
23
+ * Must be an array of `<TreeActionBase />` or `<Divider />` elements.
24
+ */
25
+ contextMenuActions?: ReactNode[];
26
+ }
27
+ /** @alpha */
28
+ export type StrataKitTreeItemProps = Omit<ComponentPropsWithoutRef<typeof Tree.Item>, "actions" | "inlineActions" | "expanded" | "onExpandedChange" | "icon" | "unstable_decorations" | "error"> & {
29
+ /**
30
+ * Used to render elements between expander and label.
31
+ * E.g. icons, color picker, etc.
32
+ */
33
+ decorations?: ReactNode;
34
+ };
35
+ /** @internal */
36
+ export type TreeNodeRendererProps = StrataKitTreeItemProps & TreeNodeRendererOwnProps;
37
+ /**
38
+ * A component that renders given `FlatTreeNode` using the `Tree.Item` component from `@itwin/itwinui-react`. The
39
+ * `FlatTreeNode` objects for this renderer are generally created using the `useFlatTreeNodeList` hook.
40
+ *
41
+ * @internal
42
+ */
43
+ export declare const StrataKitTreeNodeRenderer: FC<PropsWithRef<TreeNodeRendererProps & RefAttributes<HTMLElement>>>;
44
+ export declare const PlaceholderNode: FC<PropsWithRef<Pick<StrataKitTreeItemProps, "style" | "aria-level" | "aria-posinset" | "aria-setsize"> & RefAttributes<HTMLElement>>>;
45
+ export {};
46
+ //# sourceMappingURL=TreeNodeRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAEL,wBAAwB,EACxB,EAAE,EAIF,YAAY,EACZ,SAAS,EACT,aAAa,EAOd,MAAM,OAAO,CAAC;AAKf,OAAO,EAA6C,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAK1C,gBAAgB;AAChB,UAAU,wBAAyB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,YAAY,CAAC;IAC7F,6BAA6B;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAC;CAClC;AAED,aAAa;AACb,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACvC,wBAAwB,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,EAC1C,SAAS,GAAG,eAAe,GAAG,UAAU,GAAG,kBAAkB,GAAG,MAAM,GAAG,sBAAsB,GAAG,OAAO,CAC1G,GAAG;IACF;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,gBAAgB;AAChB,MAAM,MAAM,qBAAqB,GAAG,sBAAsB,GAAG,wBAAwB,CAAC;AAEtF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC,YAAY,CAAC,qBAAqB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CA2H1G,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,EAAE,CAC9B,YAAY,CAAC,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,YAAY,GAAG,eAAe,GAAG,cAAc,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAgBnI,CAAC"}
@@ -0,0 +1,132 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ import "./TreeNodeRenderer.css";
7
+ import { cloneElement, forwardRef, isValidElement, memo, useCallback, useEffect, useId, useMemo, useRef, useState, } from "react";
8
+ import { Description, IconButton, Spinner, Text, TextBox } from "@stratakit/bricks";
9
+ import checkmarkSvg from "@stratakit/icons/checkmark.svg";
10
+ import dismissSvg from "@stratakit/icons/dismiss.svg";
11
+ import refreshSvg from "@stratakit/icons/refresh.svg";
12
+ import { DropdownMenu, unstable_Popover as Popover, Tree } from "@stratakit/structures";
13
+ import { useLocalizationContext } from "./LocalizationContext.js";
14
+ import { TreeActionBase } from "./TreeAction.js";
15
+ import { useTreeNodeRenameContext } from "./TreeNodeRenameAction.js";
16
+ /**
17
+ * A component that renders given `FlatTreeNode` using the `Tree.Item` component from `@itwin/itwinui-react`. The
18
+ * `FlatTreeNode` objects for this renderer are generally created using the `useFlatTreeNodeList` hook.
19
+ *
20
+ * @internal
21
+ */
22
+ export const StrataKitTreeNodeRenderer = memo(forwardRef(function HierarchyNode(props, forwardedRef) {
23
+ const { node, decorations, inlineActions, menuActions, contextMenuActions, expandNode, reloadTree, ...treeItemProps } = props;
24
+ const { localizedStrings } = useLocalizationContext();
25
+ const renameContext = useTreeNodeRenameContext();
26
+ const [contextMenuProps, setContextMenuProps] = useState(undefined);
27
+ const label = treeItemProps.label ?? node.label;
28
+ const inlineActionItems = useMemo(() => {
29
+ if (node.error !== undefined && node.error.type === "ChildrenLoad") {
30
+ return [
31
+ _jsx(TreeActionBase, { label: localizedStrings.retry, onClick: () => reloadTree({ parentNodeId: node.id, state: "reset" }), visible: true, icon: refreshSvg, variant: "inline" }, "retry"),
32
+ ];
33
+ }
34
+ if (!inlineActions) {
35
+ return undefined;
36
+ }
37
+ return injectActionVariant(inlineActions, "inline");
38
+ }, [node, inlineActions, localizedStrings.retry, reloadTree]);
39
+ const menuActionItems = useMemo(() => {
40
+ if (!menuActions) {
41
+ return undefined;
42
+ }
43
+ return injectActionVariant(menuActions, "default");
44
+ }, [menuActions]);
45
+ const expanded = useMemo(() => {
46
+ if (node.error) {
47
+ return undefined;
48
+ }
49
+ if (node.isExpanded || node.children === true || node.children.length > 0) {
50
+ return node.isExpanded;
51
+ }
52
+ return undefined;
53
+ }, [node.children, node.error, node.isExpanded]);
54
+ const { renameParameters, cancelRename } = renameContext ?? {};
55
+ const labelEditor = (_jsx(LabelEditor, { initialLabel: node.label, onChange: renameParameters?.commit, onCancel: cancelRename, labelValidationHint: renameParameters?.labelValidationHint, validate: renameParameters?.validate }));
56
+ return (_jsxs(_Fragment, { children: [_jsx(Popover, { content: labelEditor, placement: "bottom", open: renameParameters?.nodeId === node.id, setOpen: cancelRename, unmountOnHide: true, children: _jsx(Tree.Item, { ...treeItemProps, ref: forwardedRef, label: label, expanded: expanded, onExpandedChange: useCallback((isExpanded) => {
57
+ expandNode(node.id, isExpanded);
58
+ }, [node, expandNode]), inlineActions: inlineActionItems, actions: menuActionItems, unstable_decorations: decorations, error: node.error ? node.error.id : undefined, onContextMenu: (e) => {
59
+ if (treeItemProps.onContextMenu) {
60
+ treeItemProps.onContextMenu(e);
61
+ }
62
+ if (!contextMenuActions) {
63
+ return;
64
+ }
65
+ e.preventDefault();
66
+ const actions = injectActionVariant(contextMenuActions, "context-menu");
67
+ if (actions.length === 0) {
68
+ return;
69
+ }
70
+ setContextMenuProps({
71
+ position: {
72
+ x: e.clientX,
73
+ y: e.clientY,
74
+ },
75
+ actions,
76
+ });
77
+ } }) }), _jsxs(DropdownMenu.Provider, { open: contextMenuProps !== undefined, setOpen: (open) => {
78
+ if (!open) {
79
+ setContextMenuProps(undefined);
80
+ }
81
+ }, children: [contextMenuProps ? (_jsx(DropdownMenu.Button, { style: { position: "fixed", top: contextMenuProps.position.y, left: contextMenuProps.position.x }, render: _jsx("div", {}) })) : null, _jsx(DropdownMenu.Content, { focusable: true, autoFocus: true, children: contextMenuProps?.actions })] }, `${node.id}-${contextMenuProps?.position.x ?? ""}-${contextMenuProps?.position.y ?? ""}`)] }));
82
+ }));
83
+ export const PlaceholderNode = memo(forwardRef(function PlaceholderNode({ ...props }, forwardedRef) {
84
+ const { localizedStrings } = useLocalizationContext();
85
+ return (_jsx(Tree.Item, { ...props, ref: forwardedRef, label: localizedStrings.loading, unstable_decorations: _jsx(Spinner, { size: "small", title: localizedStrings.loading }) }));
86
+ }));
87
+ function LabelEditor({ initialLabel, labelValidationHint, onChange, onCancel, validate, }) {
88
+ const { localizedStrings } = useLocalizationContext();
89
+ const inputRef = useRef(null);
90
+ const [newLabelValue, setNewLabelValue] = useState(initialLabel);
91
+ const [hasError, setHasError] = useState(false);
92
+ const handleLabelChange = () => {
93
+ if (validate && !validate(newLabelValue)) {
94
+ setHasError(true);
95
+ return;
96
+ }
97
+ if (initialLabel !== newLabelValue) {
98
+ onChange?.(newLabelValue);
99
+ return;
100
+ }
101
+ onCancel?.();
102
+ };
103
+ const cancelLabelChange = () => {
104
+ setNewLabelValue(initialLabel);
105
+ onCancel?.();
106
+ };
107
+ useEffect(() => {
108
+ if (inputRef.current) {
109
+ inputRef.current.focus();
110
+ inputRef.current.select();
111
+ }
112
+ }, []);
113
+ const canRename = newLabelValue && newLabelValue !== initialLabel && !hasError;
114
+ const inputId = useId();
115
+ return (_jsxs("div", { className: "phr-node-label-editor", children: [_jsxs("div", { className: "phr-node-label-editor-input-row", children: [_jsx(TextBox.Root, { style: { width: "100%" }, className: hasError ? "with-error" : undefined, children: _jsx(TextBox.Input, { id: inputId, ref: inputRef, value: newLabelValue, onChange: (event) => {
116
+ setNewLabelValue(event.target.value);
117
+ setHasError(false);
118
+ }, onKeyDown: (event) => {
119
+ if (event.key === "Enter") {
120
+ handleLabelChange();
121
+ }
122
+ else if (event.key === "Escape") {
123
+ cancelLabelChange();
124
+ }
125
+ } }) }), _jsx(IconButton, { icon: dismissSvg, label: localizedStrings.cancel, onClick: cancelLabelChange }), _jsx(IconButton, { icon: checkmarkSvg, label: localizedStrings.confirm, onClick: handleLabelChange, disabled: !canRename })] }), labelValidationHint !== undefined ? (_jsx(Description, { id: inputId, tone: hasError ? "critical" : "neutral", style: { display: "flex" }, children: _jsx(Text, { variant: "caption-lg", children: labelValidationHint }) })) : undefined] }, initialLabel));
126
+ }
127
+ function injectActionVariant(actions, variant) {
128
+ return actions
129
+ .filter((action) => isValidElement(action))
130
+ .map((action) => cloneElement(action, { variant }));
131
+ }
132
+ //# sourceMappingURL=TreeNodeRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeR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KAAK,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,SAAS,GAAI,IACjH,EACL,mBAAmB,KAAK,SAAS,CAAC,CAAC,CAAC,CACnC,KAAC,WAAW,IAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,YAC3F,KAAC,IAAI,IAAC,OAAO,EAAC,YAAY,YAAE,mBAAmB,GAAQ,GAC3C,CACf,CAAC,CAAC,CAAC,SAAS,KA3BL,YAAY,CA4BhB,CACP,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAoB,EAAE,OAA4C;IAC7F,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAA2B,MAAM,CAAC,CAAC;SACpE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAA2B,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC","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 ComponentPropsWithoutRef,\n FC,\n forwardRef,\n isValidElement,\n memo,\n PropsWithRef,\n ReactNode,\n RefAttributes,\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 checkmarkSvg from \"@stratakit/icons/checkmark.svg\";\nimport dismissSvg from \"@stratakit/icons/dismiss.svg\";\nimport refreshSvg from \"@stratakit/icons/refresh.svg\";\nimport { DropdownMenu, unstable_Popover as Popover, Tree } from \"@stratakit/structures\";\nimport { TreeRendererProps } from \"../Renderers.js\";\nimport { TreeNode } from \"../TreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeActionBase, TreeActionBaseAttributes } from \"./TreeAction.js\";\nimport { useTreeNodeRenameContext } from \"./TreeNodeRenameAction.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 given `FlatTreeNode` using the `Tree.Item` component from `@itwin/itwinui-react`. The\n * `FlatTreeNode` objects for this renderer are generally created using the `useFlatTreeNodeList` hook.\n *\n * @internal\n */\nexport const StrataKitTreeNodeRenderer: FC<PropsWithRef<TreeNodeRendererProps & RefAttributes<HTMLElement>>> = memo(\n forwardRef<HTMLElement, TreeNodeRendererProps>(function HierarchyNode(props, forwardedRef) {\n const { node, decorations, inlineActions, menuActions, contextMenuActions, expandNode, reloadTree, ...treeItemProps } = props;\n const { localizedStrings } = useLocalizationContext();\n const renameContext = useTreeNodeRenameContext();\n const [contextMenuProps, setContextMenuProps] = useState<{ position: { x: number; y: number }; actions: ReactNode[] } | undefined>(undefined);\n\n const label = treeItemProps.label ?? node.label;\n const inlineActionItems = useMemo(() => {\n if (node.error !== undefined && node.error.type === \"ChildrenLoad\") {\n return [\n <TreeActionBase\n key=\"retry\"\n label={localizedStrings.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, localizedStrings.retry, 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.error) {\n return undefined;\n }\n\n if (node.isExpanded || node.children === true || node.children.length > 0) {\n return node.isExpanded;\n }\n\n return undefined;\n }, [node.children, node.error, node.isExpanded]);\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 content={labelEditor} placement=\"bottom\" open={renameParameters?.nodeId === node.id} setOpen={cancelRename} unmountOnHide>\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.error ? node.error.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({\n position: {\n x: e.clientX,\n y: e.clientY,\n },\n actions,\n });\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 style={{ position: \"fixed\", top: contextMenuProps.position.y, left: contextMenuProps.position.x }} render={<div />} />\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<Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\"> & RefAttributes<HTMLElement>>\n> = memo(\n forwardRef<HTMLElement, Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\">>(function PlaceholderNode(\n { ...props },\n forwardedRef,\n ) {\n const { localizedStrings } = useLocalizationContext();\n return (\n <Tree.Item\n {...props}\n ref={forwardedRef}\n label={localizedStrings.loading}\n unstable_decorations={<Spinner size={\"small\"} title={localizedStrings.loading} />}\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 { localizedStrings } = useLocalizationContext();\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 value={newLabelValue}\n onChange={(event) => {\n setNewLabelValue(event.target.value);\n setHasError(false);\n }}\n onKeyDown={(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={localizedStrings.cancel} onClick={cancelLabelChange} />\n <IconButton icon={checkmarkSvg} label={localizedStrings.confirm} onClick={handleLabelChange} disabled={!canRename} />\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"]}
@@ -0,0 +1,75 @@
1
+ import { ComponentProps, ComponentPropsWithoutRef, FC, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from "react";
2
+ import { Tree } from "@stratakit/structures";
3
+ import { TreeRendererProps } from "../Renderers.js";
4
+ import { TreeNode } from "../TreeNode.js";
5
+ import { SelectionMode } from "../UseSelectionHandler.js";
6
+ import { LocalizationContextProvider } from "./LocalizationContext.js";
7
+ import { TreeErrorRendererProps } from "./TreeErrorRenderer.js";
8
+ import { TreeNodeEditingProps } from "./TreeNodeRenameAction.js";
9
+ import { StrataKitTreeItemProps } from "./TreeNodeRenderer.js";
10
+ /** @alpha */
11
+ interface TreeRendererOwnProps {
12
+ id?: string;
13
+ /**
14
+ * A user friendly display label of the tree. Should be unique within the consuming application,
15
+ * as it's used for accessibility purposes.
16
+ */
17
+ treeLabel: string;
18
+ /** Active selection mode used by the tree. Defaults to `"single"`. */
19
+ selectionMode?: SelectionMode;
20
+ /** A render function for errors' display component. Defaults to `<TreeErrorRenderer />`. */
21
+ errorRenderer?: (props: TreeErrorRendererProps) => ReactElement;
22
+ /** Props that defines if current node supports editing. */
23
+ getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined;
24
+ /** Custom props for the root Tree component. */
25
+ treeRootProps?: Partial<Omit<ComponentProps<typeof Tree.Root>, "style">>;
26
+ /** A callback that returns tree item props for specific node. */
27
+ getTreeItemProps?: (node: TreeNode) => Partial<Omit<StrataKitTreeItemProps, "selected" | "aria-level" | "aria-posinset" | "aria-setsize">>;
28
+ /**
29
+ * Callback that returns menu actions for tree item.
30
+ * Must return an array of `<TreeActionBase />` or `<Divider />` elements.
31
+ */
32
+ getMenuActions?: (props: {
33
+ targetNode: TreeNode;
34
+ selectedNodes: TreeNode[];
35
+ }) => ReactNode[];
36
+ /**
37
+ * Callback that returns inline actions for tree item.
38
+ * Must return an array of `<TreeActionBase />` elements.
39
+ * Max 2 items.
40
+ */
41
+ getInlineActions?: (props: {
42
+ targetNode: TreeNode;
43
+ selectedNodes: TreeNode[];
44
+ }) => ReactNode[];
45
+ /**
46
+ * Callback that returns actions for tree item context menu.
47
+ * Must return an array of `<TreeActionBase />` or `<Divider />` elements.
48
+ */
49
+ getContextMenuActions?: (props: {
50
+ targetNode: TreeNode;
51
+ selectedNodes: TreeNode[];
52
+ }) => ReactNode[];
53
+ }
54
+ /** @alpha */
55
+ export interface StrataKitTreeRendererAttributes {
56
+ /**
57
+ * Opens rename mode for the first node that matches the given predicate. Node must be already loaded in the tree.
58
+ * 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.
59
+ *
60
+ * Returns "node-not-found" if no node matches the predicate, "success" if rename was initiated.
61
+ */
62
+ renameNode: (nodePredicate: (node: TreeNode) => boolean) => "node-not-found" | "success";
63
+ }
64
+ /** @alpha */
65
+ type StrataKitTreeRendererProps = TreeRendererProps & Pick<TreeErrorRendererProps, "filterHierarchyLevel"> & TreeRendererOwnProps & ComponentPropsWithoutRef<typeof LocalizationContextProvider>;
66
+ /**
67
+ * A component that renders a tree using the `Tree` component from `@itwin/itwinui-react`. The tree nodes
68
+ * are rendered using `TreeNodeRenderer` component from this package.
69
+ *
70
+ * @see https://itwinui.bentley.com/docs/tree
71
+ * @alpha
72
+ */
73
+ export declare const StrataKitTreeRenderer: FC<PropsWithoutRef<StrataKitTreeRendererProps> & RefAttributes<StrataKitTreeRendererAttributes>>;
74
+ export {};
75
+ //# sourceMappingURL=TreeRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,cAAc,EACd,wBAAwB,EAExB,EAAE,EAGF,eAAe,EACf,YAAY,EACZ,SAAS,EACT,aAAa,EAMd,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAuB,MAAM,2BAA2B,CAAC;AAG/E,OAAO,EAAE,2BAA2B,E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