yarn: update react-complex-tree to v2.0.0

Includes fixes for breaking changes.
This commit is contained in:
David Lechner
2022-12-17 12:05:52 -06:00
committed by David Lechner
parent 8b3fa29f65
commit ee466ac904
4 changed files with 28 additions and 19 deletions
+1 -1
View File
@@ -370,7 +370,7 @@ const FileTree: React.VoidFunctionComponent = () => {
[rootItemIndex]: {
index: rootItemIndex,
data: { fileName: '/' },
hasChildren: true,
isFolder: true,
children: [...files].map((f) => f.uuid),
},
} as Record<TreeItemIndex, FileTreeItem>,
+19 -12
View File
@@ -18,6 +18,7 @@ import {
import React, { createContext } from 'react';
import { TreeItem, TreeRenderProps, useTree } from 'react-complex-tree';
import { useBoolean } from 'usehooks-ts';
import { assert } from '.';
/** Combines class names into a string. */
const cx = (...classNames: Array<string | undefined | false>): string =>
@@ -99,7 +100,7 @@ export const renderers: Omit<
)}
{...props.context.itemContainerWithoutChildrenProps}
>
{props.item.hasChildren ? (
{props.item.isFolder ? (
props.arrow
) : (
<span className={Classes.TREE_NODE_CARET_NONE} />
@@ -201,17 +202,23 @@ export const renderers: Omit<
</form>
),
renderSearchInput: (props) => (
<div className={cx('rct-tree-search-input-container')}>
<InputGroup
{...(props.inputProps as Omit<
React.HTMLAttributes<HTMLInputElement>,
'defaultValue'
>)}
placeholder="Search..."
/>
</div>
),
renderSearchInput: (props) => {
const { ref, defaultValue, value, ...inputProps } = props.inputProps;
assert(typeof ref !== 'string', 'cannot be a legacy ref');
// unused - have to be excluded from inputProps for InputGroup typing compatibility
defaultValue;
value;
// TODO: translate placeholder and inputProps.aria-label
return (
<div className={cx('rct-tree-search-input-container')}>
<InputGroup inputRef={ref} {...inputProps} placeholder="Search..." />
</div>
);
},
renderDepthOffset: 1,
};