@itwin/presentation-hierarchies-react 2.0.0-alpha.54 → 2.0.0-alpha.56

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 (128) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +23 -61
  3. package/lib/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
  4. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/TreeNode.d.ts +2 -0
  5. package/lib/presentation-hierarchies-react/TreeNode.d.ts.map +1 -0
  6. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseIModelTree.d.ts +1 -1
  7. package/lib/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -0
  8. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseIModelTree.js +43 -48
  9. package/lib/presentation-hierarchies-react/UseIModelTree.js.map +1 -0
  10. package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
  11. package/lib/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
  12. package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -0
  13. package/lib/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -0
  14. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseTree.d.ts +8 -3
  15. package/lib/presentation-hierarchies-react/UseTree.d.ts.map +1 -0
  16. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseTree.js +21 -21
  17. package/lib/presentation-hierarchies-react/UseTree.js.map +1 -0
  18. package/lib/presentation-hierarchies-react/Utils.js.map +1 -0
  19. package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -0
  20. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts +9 -0
  21. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts.map +1 -0
  22. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js +12 -0
  23. package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js.map +1 -0
  24. package/lib/presentation-hierarchies-react/internal/TreeActions.js.map +1 -0
  25. package/lib/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -0
  26. package/lib/presentation-hierarchies-react/internal/TreeModel.js.map +1 -0
  27. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -0
  28. package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -0
  29. package/lib/presentation-hierarchies-react/internal/Utils.js.map +1 -0
  30. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/ErrorItemRenderer.d.ts +3 -3
  31. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
  32. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/ErrorItemRenderer.js +158 -128
  33. package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
  34. package/lib/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -0
  35. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/FlatTreeNode.js +7 -4
  36. package/lib/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -0
  37. package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +24 -0
  38. package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -0
  39. package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.js +41 -0
  40. package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -0
  41. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
  42. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/RootErrorRenderer.js +64 -46
  43. package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
  44. package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
  45. package/lib/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
  46. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeErrorRenderer.d.ts +3 -3
  47. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
  48. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeErrorRenderer.js +19 -20
  49. package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
  50. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -0
  51. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeFilterAction.js +43 -30
  52. package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -0
  53. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -0
  54. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenameAction.js +37 -31
  55. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -0
  56. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
  57. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenderer.js +227 -192
  58. package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
  59. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeRenderer.d.ts +3 -6
  60. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
  61. package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeRenderer.js +39 -45
  62. package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
  63. package/lib/{esm/presentation-hierarchies-react.d.ts → presentation-hierarchies-react.d.ts} +3 -2
  64. package/lib/{esm/presentation-hierarchies-react.js → presentation-hierarchies-react.js} +3 -2
  65. package/lib/public/locales/en/PresentationHierarchies_1.0.json +26 -0
  66. package/package.json +19 -15
  67. package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +0 -1
  68. package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +0 -1
  69. package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +0 -1
  70. package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +0 -1
  71. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +0 -1
  72. package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +0 -1
  73. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +0 -1
  74. package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +0 -1
  75. package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +0 -1
  76. package/lib/esm/presentation-hierarchies-react/UseTree.js.map +0 -1
  77. package/lib/esm/presentation-hierarchies-react/Utils.js.map +0 -1
  78. package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +0 -1
  79. package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +0 -1
  80. package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +0 -1
  81. package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +0 -1
  82. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +0 -1
  83. package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +0 -1
  84. package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +0 -1
  85. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +0 -1
  86. package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +0 -1
  87. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +0 -1
  88. package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +0 -1
  89. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +0 -138
  90. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +0 -1
  91. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js +0 -67
  92. package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +0 -1
  93. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +0 -1
  94. package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +0 -1
  95. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +0 -1
  96. package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js.map +0 -1
  97. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +0 -1
  98. package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +0 -1
  99. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +0 -1
  100. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +0 -1
  101. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +0 -1
  102. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +0 -1
  103. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +0 -1
  104. package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +0 -1
  105. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +0 -1
  106. package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +0 -1
  107. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/Renderers.d.ts +0 -0
  108. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseNodeHighlighting.d.ts +0 -0
  109. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseNodeHighlighting.js +0 -0
  110. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseSelectionHandler.d.ts +0 -0
  111. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseSelectionHandler.js +0 -0
  112. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/Utils.js +0 -0
  113. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/DisposePolyfill.js +0 -0
  114. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeActions.js +0 -0
  115. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeLoader.js +0 -0
  116. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeModel.d.ts +0 -0
  117. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeModel.js +0 -0
  118. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/UseUnifiedSelection.d.ts +0 -0
  119. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/UseUnifiedSelection.js +0 -0
  120. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/Utils.js +0 -0
  121. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/FlatTreeNode.d.ts +0 -0
  122. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/RootErrorRenderer.d.ts +0 -0
  123. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeAction.d.ts +0 -0
  124. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeAction.js +0 -0
  125. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeFilterAction.d.ts +0 -0
  126. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenameAction.d.ts +0 -0
  127. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenderer.css +0 -0
  128. /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenderer.d.ts +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"TreeNodeRenderer.js","names":["cloneElement","forwardRef","isValidElement","memo","useCallback","useEffect","useId","useMemo","useRef","useState","Description","IconButton","Spinner","Text","TextBox","checkmarkSvg","dismissSvg","refreshSvg","DropdownMenu","unstable_Popover","Popover","Tree","useLocalizationContext","TreeActionBase","useTreeNodeRenameContext","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","localizedStrings","renameContext","contextMenuProps","setContextMenuProps","undefined","label","t0","bb0","error","type","t1","id","parentNodeId","state","t2","retry","injectActionVariant","inlineActionItems","bb1","menuActionItems","bb2","children","length","isExpanded","expanded","t3","renameParameters","cancelRename","t4","commit","t5","labelValidationHint","t6","validate","t7","labelEditor","t8","nodeId","t9","t10","t11","t12","e","onContextMenu","preventDefault","actions","position","x","clientX","y","clientY","t13","t14","t15","t16","Symbol","for","open","t17","t18","top","left","t19","t20","t21","t22","PlaceholderNode","loading","LabelEditor","initialLabel","onChange","onCancel","inputRef","newLabelValue","setNewLabelValue","hasError","setHasError","handleLabelChange","cancelLabelChange","current","focus","select","canRename","inputId","width","event","target","value","event_0","key","newLabel","cancel","confirm","display","variant","filter","action","map"],"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 { cloneElement, forwardRef, isValidElement, memo, useCallback, useEffect, useId, useMemo, useRef, useState } 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 { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\nimport { useTreeNodeRenameContext } from \"./TreeNodeRenameAction.js\";\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 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 // 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 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 aria-label={localizedStrings.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={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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiEA,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,iBAAwHN;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;;CAC9H,MAAA,EAAAK,qBAA6BhC,wBAAwB;CACrD,MAAAiC,gBAAsB/B,0BAA0B;CAChD,MAAA,CAAAgC,kBAAAC,uBAAgDhD,SAAmFiD,OAAU;CAE7I,MAAAC,QAAcN,cAAaM,SAAUxB,KAAIwB;CAAO,IAAAC;AAAAC,MAAA;AAE9C,MAAI1B,KAAI2B,UAAWJ,UAAavB,KAAI2B,MAAMC,SAAU,gBAAc;GAAA,IAAAC;AAAA,OAAAf,EAAA,OAAAd,KAAA8B,MAAAhB,EAAA,QAAAG,YAAA;AAKnD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A;EAWO;;;;;EALxF,gBAAA,IAAoB,KAAA;IAAS,UAAA,EAAY,QAAA;IAAU,aAAA,EAAe,QAAA;EAAA,MAAiB,SAAA;EApBlE;;;;EAyBjB,qBAAA,IAAyB,KAAA;IAAS,UAAA,EAAY,QAAA;IAAU,aAAA,EAAe,QAAA;EAAA,MAAiB,SAAA;AAAA;;UAIzE,+BAAA;EAxByC;;;;;;EA+BxD,UAAA,GAAa,aAAA,GAAgB,IAAA,EAAM,QAAA;AAAA;;KAIhC,0BAAA,GAA6B,iBAAA,GAChC,IAAA,CAAK,sBAAA,4BACL,oBAAA,GACA,wBAAA,QAAgC,2BAAA;;;;;;;;cASrB,qBAAA,EAAuB,EAAA,CAAG,eAAA,CAAgB,0BAAA,IAA8B,aAAA,CAAc,+BAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TreeRenderer.js","names":["forwardRef","memo","useCallback","useEffect","useImperativeHandle","useMemo","useRef","Tree","useVirtualizer","useSelectionHandler","useEvent","useMergedRefs","isPlaceholderItem","useErrorNodes","useFlatTreeItems","LocalizationContextProvider","TreeErrorRenderer","TreeNodeRenameContextProvider","useTreeNodeRenameContextValue","PlaceholderNode","StrataKitTreeNodeRenderer","ComponentProps","ComponentPropsWithoutRef","CSSProperties","FC","PropsWithoutRef","ReactElement","ReactNode","RefAttributes","TreeRendererProps","TreeNode","SelectionMode","FlatTreeItem","FlatTreeNodeItem","TreeErrorRendererProps","TreeNodeEditingProps","StrataKitTreeItemProps","TreeNodeRendererProps","TreeRendererOwnProps","id","treeLabel","selectionMode","errorRenderer","props","getEditingProps","node","treeRootProps","Partial","Omit","Root","getTreeItemProps","getMenuActions","targetNode","selectedNodes","getInlineActions","getContextMenuActions","StrataKitTreeRendererAttributes","renameNode","nodePredicate","StrataKitTreeRendererProps","Pick","StrataKitTreeRenderer","forwardedRef","rootNodes","selectNodes","expandNode","localizedStrings","getHierarchyLevelDetails","filterHierarchyLevel","reloadTree","isNodeSelected","handleNodeSelect","flatItems","errorNodes","parentRef","HTMLDivElement","virtualizer","count","length","getScrollElement","current","getItemKey","index","estimateSize","overscan","items","getVirtualItems","expandAndScrollToNode","useExpandAndScrollToNode","renameContext","onComplete","requestAnimationFrame","startRename","cancelRename","isScrolling","errorRendererProps","scrollToNode","n","parentNodeId","state","getSelectedNodes","calculatedSelectedNodes","undefined","filter","item","map","height","width","overflowY","getTotalSize","minHeight","position","overflow","virtualizedItem","selected","measureElement","key","start","t0","$","_c","t1","pathToNode","findPathToNode","pop","collapsedNodes","_temp","forEach","didExpand","expandToNode","t2","t3","targetNodeId","findIndex","flatItem","scrollToIndex","align","onScrollComplete","t4","t5","nodePredicate_0","expandResult","targetNode_0","index_0","flatItem_0","pathNode","isExpanded","parent","children","childPath","VirtualTreeItemProps","HierarchyNodeItemProps","VirtualTreeItem","HTMLElement","top","left","transform","willChange","style","level","ReturnType","HierarchyNodeItem","rest","nodeRef","treeItemProps","isDisabled","menuActions","inlineActions","contextMenuActions","nodeActions","t6","e","onClick","detail","nodeId","isSelected","shiftDown","shiftKey","ctrlDown","ctrlKey","t7","e_0","onMouseDown","preventDefault","ref","t8","levelSize","posInLevel"],"sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeRenderer.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 { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from \"react\";\nimport { Tree } from \"@stratakit/structures\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport { useSelectionHandler } from \"../UseSelectionHandler.js\";\nimport { useEvent, useMergedRefs } from \"../Utils.js\";\nimport { isPlaceholderItem, useErrorNodes, useFlatTreeItems } from \"./FlatTreeNode.js\";\nimport { LocalizationContextProvider } from \"./LocalizationContext.js\";\nimport { TreeErrorRenderer } from \"./TreeErrorRenderer.js\";\nimport { TreeNodeRenameContextProvider, useTreeNodeRenameContextValue } from \"./TreeNodeRenameAction.js\";\nimport { PlaceholderNode, StrataKitTreeNodeRenderer } from \"./TreeNodeRenderer.js\";\n\nimport type { ComponentProps, ComponentPropsWithoutRef, CSSProperties, FC, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { SelectionMode } from \"../UseSelectionHandler.js\";\nimport type { FlatTreeItem, FlatTreeNodeItem } from \"./FlatTreeNode.js\";\nimport type { TreeErrorRendererProps } from \"./TreeErrorRenderer.js\";\nimport type { TreeNodeEditingProps } from \"./TreeNodeRenameAction.js\";\nimport type { StrataKitTreeItemProps, TreeNodeRendererProps } from \"./TreeNodeRenderer.js\";\n\n/** @alpha */\ninterface TreeRendererOwnProps {\n id?: string;\n /**\n * A user friendly display label of the tree. Should be unique within the consuming application,\n * as it's used for accessibility purposes.\n */\n treeLabel: string;\n /** Active selection mode used by the tree. Defaults to `\"single\"`. */\n selectionMode?: SelectionMode;\n /** A render function for errors' display component. Defaults to `<TreeErrorRenderer />`. */\n errorRenderer?: (props: TreeErrorRendererProps) => ReactElement;\n /** Props that defines if current node supports editing. */\n getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined;\n\n /** Custom props for the root Tree component. */\n treeRootProps?: Partial<Omit<ComponentProps<typeof Tree.Root>, \"style\">>;\n\n /** A callback that returns tree item props for specific node. */\n getTreeItemProps?: (node: TreeNode) => Partial<Omit<StrataKitTreeItemProps, \"selected\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\">>;\n\n /**\n * Callback that returns menu actions for tree item.\n * Must return an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n getMenuActions?: (props: { targetNode: TreeNode; selectedNodes: TreeNode[] }) => ReactNode[];\n /**\n * Callback that returns inline actions for tree item.\n * Must return an array of `<TreeActionBase />` elements.\n * Max 2 items.\n */\n getInlineActions?: (props: { targetNode: TreeNode; selectedNodes: TreeNode[] }) => ReactNode[];\n /**\n * Callback that returns actions for tree item context menu.\n * Must return an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n getContextMenuActions?: (props: { targetNode: TreeNode; selectedNodes: TreeNode[] }) => ReactNode[];\n}\n\n/** @alpha */\nexport interface StrataKitTreeRendererAttributes {\n /**\n * Opens rename mode for the first node that matches the given predicate. Node must be already loaded in the tree.\n * 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.\n *\n * Returns \"node-not-found\" if no node matches the predicate, \"success\" if rename was initiated.\n */\n renameNode: (nodePredicate: (node: TreeNode) => boolean) => \"node-not-found\" | \"success\";\n}\n\n/** @alpha */\ntype StrataKitTreeRendererProps = TreeRendererProps &\n Pick<TreeErrorRendererProps, \"filterHierarchyLevel\"> &\n TreeRendererOwnProps &\n ComponentPropsWithoutRef<typeof LocalizationContextProvider>;\n\n/**\n * A component that renders a tree using the `Tree` component from `@itwin/itwinui-react`. The tree nodes\n * are rendered using `TreeNodeRenderer` component from this package.\n *\n * @see https://itwinui.bentley.com/docs/tree\n * @alpha\n */\nexport const StrataKitTreeRenderer: FC<PropsWithoutRef<StrataKitTreeRendererProps> & RefAttributes<StrataKitTreeRendererAttributes>> = forwardRef<\n StrataKitTreeRendererAttributes,\n StrataKitTreeRendererProps\n>(function StrataKitTreeRenderer(props, forwardedRef) {\n const {\n id,\n rootNodes,\n selectNodes,\n selectionMode,\n expandNode,\n treeLabel,\n localizedStrings,\n getHierarchyLevelDetails,\n filterHierarchyLevel,\n reloadTree,\n isNodeSelected,\n errorRenderer,\n treeRootProps,\n getContextMenuActions,\n getEditingProps,\n getInlineActions,\n getMenuActions,\n getTreeItemProps,\n } = props;\n const { handleNodeSelect } = useSelectionHandler({\n rootNodes,\n selectNodes,\n selectionMode: selectionMode ?? \"single\",\n });\n const flatItems = useFlatTreeItems(rootNodes);\n const errorNodes = useErrorNodes(rootNodes);\n\n const parentRef = useRef<HTMLDivElement>(null);\n\n // eslint-disable-next-line react-hooks/incompatible-library\n const virtualizer = useVirtualizer({\n count: flatItems.length,\n getScrollElement: () => parentRef.current,\n getItemKey: useCallback((index: number) => flatItems[index].id, [flatItems]),\n estimateSize: () => 28,\n overscan: 10,\n });\n const items = virtualizer.getVirtualItems();\n const expandAndScrollToNode = useExpandAndScrollToNode({ rootNodes, flatItems, expandNode, virtualizer });\n\n const renameContext = useTreeNodeRenameContextValue({\n getEditingProps,\n });\n useImperativeHandle(forwardedRef, () => ({\n renameNode: (nodePredicate) =>\n expandAndScrollToNode({\n nodePredicate,\n onComplete: (targetNode) => {\n // give time to scroll node into view before starting rename\n requestAnimationFrame(() => renameContext.startRename(targetNode));\n },\n }),\n }));\n\n const cancelRename = renameContext.cancelRename;\n const isScrolling = virtualizer.isScrolling;\n useEffect(() => {\n if (isScrolling) {\n // cancel rename when scroll is initiated\n cancelRename();\n }\n }, [isScrolling, cancelRename]);\n\n const errorRendererProps: TreeErrorRendererProps = {\n treeLabel,\n errorNodes,\n scrollToNode: (node) => expandAndScrollToNode({ nodePredicate: (n) => n.id === node.id }),\n getHierarchyLevelDetails,\n filterHierarchyLevel,\n reloadTree: useCallback<TreeErrorRendererProps[\"reloadTree\"]>(({ parentNodeId }) => reloadTree({ parentNodeId, state: \"reset\" }), [reloadTree]),\n };\n\n const getSelectedNodes = useMemo(() => {\n let calculatedSelectedNodes: TreeNode[] | undefined;\n return () => {\n if (calculatedSelectedNodes === undefined) {\n calculatedSelectedNodes = flatItems\n .filter((item): item is FlatTreeNodeItem => !isPlaceholderItem(item) && isNodeSelected(item.id))\n .map((item) => item.node);\n }\n return calculatedSelectedNodes;\n };\n }, [flatItems, isNodeSelected]);\n\n return (\n <LocalizationContextProvider localizedStrings={localizedStrings}>\n {errorRenderer ? errorRenderer(errorRendererProps) : <TreeErrorRenderer {...errorRendererProps} />}\n <div id={id} style={{ height: \"100%\", width: \"100%\", overflowY: \"auto\" }} ref={parentRef}>\n <Tree.Root\n {...treeRootProps}\n style={{ height: virtualizer.getTotalSize(), minHeight: \"100%\", width: \"100%\", position: \"relative\", overflow: \"hidden\" }}\n >\n <TreeNodeRenameContextProvider value={renameContext}>\n {items.map((virtualizedItem) => {\n const item = flatItems[virtualizedItem.index];\n const selected = isNodeSelected(item.id);\n return (\n <VirtualTreeItem\n ref={virtualizer.measureElement}\n key={virtualizedItem.key}\n data-index={virtualizedItem.index}\n start={virtualizedItem.start}\n item={item}\n selected={selected}\n expandNode={expandNode}\n reloadTree={reloadTree}\n handleNodeSelect={handleNodeSelect}\n getSelectedNodes={getSelectedNodes}\n getContextMenuActions={getContextMenuActions}\n getInlineActions={getInlineActions}\n getMenuActions={getMenuActions}\n getTreeItemProps={getTreeItemProps}\n />\n );\n })}\n </TreeNodeRenameContextProvider>\n </Tree.Root>\n </div>\n </LocalizationContextProvider>\n );\n});\n\nfunction useExpandAndScrollToNode({\n rootNodes,\n flatItems,\n expandNode,\n virtualizer,\n}: Pick<StrataKitTreeRendererProps, \"rootNodes\" | \"expandNode\"> & {\n flatItems: ReturnType<typeof useFlatTreeItems>;\n virtualizer: Pick<ReturnType<typeof useVirtualizer>, \"scrollToIndex\">;\n}) {\n const expandToNode = (nodePredicate: (node: TreeNode) => boolean) => {\n const pathToNode = findPathToNode(rootNodes, nodePredicate);\n if (!pathToNode) {\n return undefined;\n }\n const targetNode = pathToNode.pop()!;\n const collapsedNodes = pathToNode.filter((pathNode) => !pathNode.isExpanded);\n collapsedNodes.forEach((node) => expandNode(node.id, true));\n return { targetNode, didExpand: collapsedNodes.length > 0 };\n };\n\n const scrollToNode = useRef<{ id: string; onScrollComplete?: () => void } | undefined>(undefined);\n useEffect(() => {\n if (scrollToNode.current === undefined) {\n return;\n }\n const targetNodeId = scrollToNode.current.id;\n const index = flatItems.findIndex((flatItem) => flatItem.id === targetNodeId);\n if (index === -1) {\n return;\n }\n virtualizer.scrollToIndex(index, { align: \"auto\" });\n scrollToNode.current.onScrollComplete?.();\n scrollToNode.current = undefined;\n }, [flatItems, virtualizer]);\n\n return ({ nodePredicate, onComplete }: { nodePredicate: (node: TreeNode) => boolean; onComplete?: (targetNode: TreeNode) => void }) => {\n const expandResult = expandToNode(nodePredicate);\n if (!expandResult) {\n return \"node-not-found\";\n }\n\n const { targetNode, didExpand } = expandResult;\n if (didExpand) {\n scrollToNode.current = {\n id: targetNode.id,\n onScrollComplete: onComplete ? () => onComplete(targetNode) : undefined,\n };\n } else {\n const index = flatItems.findIndex((flatItem) => flatItem.id === targetNode.id);\n virtualizer.scrollToIndex(index, { align: \"auto\" });\n onComplete?.(targetNode);\n }\n return \"success\";\n };\n}\n\nfunction findPathToNode(rootNodes: TreeNode[], nodePredicate: (node: TreeNode) => boolean): TreeNode[] | undefined {\n for (const parent of rootNodes) {\n if (nodePredicate(parent)) {\n return [parent];\n }\n if (parent.children !== true) {\n const childPath = findPathToNode(parent.children, nodePredicate);\n if (childPath) {\n return [parent, ...childPath];\n }\n }\n }\n return undefined;\n}\n\ntype VirtualTreeItemProps = Omit<HierarchyNodeItemProps, \"item\"> & {\n start: number;\n \"data-index\": number;\n item: FlatTreeItem;\n};\n\nconst VirtualTreeItem = memo(\n forwardRef<HTMLElement, VirtualTreeItemProps>(function VirtualTreeItem({ start, item, ...props }, forwardedRef) {\n const style: CSSProperties = useMemo(\n () => ({\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n transform: `translateY(${start}px)`,\n willChange: \"transform\",\n }),\n [start],\n );\n\n if (isPlaceholderItem(item)) {\n return <PlaceholderNode ref={forwardedRef} data-index={props[\"data-index\"]} style={style} aria-level={item.level} aria-posinset={1} aria-setsize={1} />;\n }\n\n return <HierarchyNodeItem {...props} ref={forwardedRef} style={style} item={item} />;\n }),\n);\n\ntype HierarchyNodeItemProps = {\n item: FlatTreeNodeItem;\n style?: CSSProperties;\n getSelectedNodes: () => TreeNode[];\n} & Pick<TreeNodeRendererProps, \"expandNode\" | \"reloadTree\" | \"selected\"> &\n Pick<TreeRendererOwnProps, \"getContextMenuActions\" | \"getInlineActions\" | \"getMenuActions\" | \"getTreeItemProps\"> &\n Pick<ReturnType<typeof useSelectionHandler>, \"handleNodeSelect\">;\n\nconst HierarchyNodeItem = memo(\n forwardRef<HTMLElement, HierarchyNodeItemProps>(function HierarchyNodeItem(\n { item, selected, getTreeItemProps, handleNodeSelect, getSelectedNodes, getMenuActions, getInlineActions, getContextMenuActions, ...rest },\n forwardedRef,\n ) {\n const nodeRef = useRef<HTMLElement>(null);\n const node = item.node;\n const treeItemProps = getTreeItemProps?.(node);\n\n const isDisabled = treeItemProps?.[\"aria-disabled\"] === true;\n const nodeActions = useMemo(\n () => ({\n menuActions: getMenuActions ? getMenuActions({ targetNode: node, selectedNodes: getSelectedNodes() }) : undefined,\n inlineActions: getInlineActions ? getInlineActions({ targetNode: node, selectedNodes: getSelectedNodes() }) : undefined,\n contextMenuActions: getContextMenuActions ? getContextMenuActions({ targetNode: node, selectedNodes: getSelectedNodes() }) : undefined,\n }),\n [node, getMenuActions, getInlineActions, getContextMenuActions, getSelectedNodes],\n );\n\n const onClick = useEvent<Required<TreeNodeRendererProps>[\"onClick\"]>((e) => {\n if (treeItemProps?.onClick) {\n treeItemProps.onClick(e);\n }\n // ignore if this is double click\n if (isDisabled || e.detail > 1) {\n return;\n }\n handleNodeSelect({ nodeId: node.id, isSelected: selected ?? false, shiftDown: e.shiftKey, ctrlDown: e.ctrlKey });\n });\n\n const onMouseDown = useEvent<Required<TreeNodeRendererProps>[\"onMouseDown\"]>((e) => {\n if (treeItemProps?.onMouseDown) {\n treeItemProps.onMouseDown(e);\n }\n // prevent text selection on shift+click\n if (e.shiftKey) {\n e.preventDefault();\n }\n });\n\n const ref = useMergedRefs(forwardedRef, nodeRef);\n return (\n <StrataKitTreeNodeRenderer\n {...treeItemProps}\n {...rest}\n {...nodeActions}\n ref={ref}\n aria-level={item.level}\n aria-posinset={item.posInLevel}\n aria-setsize={item.levelSize}\n node={item.node}\n selected={selected}\n onClick={onClick}\n onMou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