Skip to content

Commit 021537f

Browse files
authored
Forward Ref Assertion (#103)
* Escape Entities * Type Assert The Forward Ref * Remove references to version 2 in the readme * Update the test workflow * Case Sensisitve for Linux
1 parent 6fd355f commit 021537f

File tree

6 files changed

+16
-13
lines changed

6 files changed

+16
-13
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ jobs:
1313
node-version: "16.x"
1414
registry-url: "https://registry.npmjs.org"
1515
- run: yarn
16-
- run: yarn workspace react-arborist build
16+
- run: yarn build
17+
- run: yarn build:showcase

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,13 @@ Here is a Gmail sidebar clone built with react-arborist.
1717
- Inline renaming
1818
- Virtualized rendering
1919
- Custom styling
20-
21-
**New Features in Version 2**
22-
2320
- Keyboard navigation
2421
- Aria attributes
2522
- Tree filtering
2623
- Selection synchronization
27-
- More callbacks (onScroll, onActivate, onSelect)
24+
- Callbacks (onScroll, onActivate, onSelect)
2825
- Controlled or uncontrolled trees
2926

30-
> These docs are for version 2. It contains breaking changes. Here is the [v1.2.0 README](https://github.com/brimdata/react-arborist/tree/4fe9659d2c4cbd57582294330863d4fd7e7af74b).
31-
3227
## Installation
3328

3429
```

packages/react-arborist/src/components/tree.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { TreeProps } from "../types/tree-props";
88
import { IdObj } from "../types/utils";
99
import { useValidatedProps } from "../hooks/use-validated-props";
1010

11-
export const Tree = forwardRef(function Tree<T>(
11+
function TreeComponent<T>(
1212
props: TreeProps<T>,
1313
ref: React.Ref<TreeApi<T> | undefined>
1414
) {
@@ -21,4 +21,8 @@ export const Tree = forwardRef(function Tree<T>(
2121
<DragPreviewContainer />
2222
</TreeProvider>
2323
);
24-
});
24+
}
25+
26+
export const Tree = forwardRef(TreeComponent) as <T>(
27+
props: TreeProps<T> & { ref?: React.ForwardedRef<TreeApi<T> | undefined> }
28+
) => ReturnType<typeof TreeComponent>;

packages/showcase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
7-
"build": "next build && next export && open out",
7+
"build": "next build && next export",
88
"start": "next start",
99
"lint": "next lint"
1010
},

packages/showcase/pages/gmail.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import clsx from "clsx";
22
import { CursorProps, NodeApi, NodeRendererProps, Tree } from "react-arborist";
33
import { gmailData, GmailItem } from "../data/gmail";
44
import * as icons from "react-icons/md";
5-
import styles from "../styles/gmail.module.css";
5+
import styles from "../styles/Gmail.module.css";
66
import { FillFlexParent } from "../components/fill-flex-parent";
77
import { SiGmail } from "react-icons/si";
88
import { BsTree } from "react-icons/bs";
@@ -69,7 +69,10 @@ export default function GmailSidebar() {
6969
<li>Try to drag Inbox into Categories (not allowed)</li>
7070
<li>Move focus with the arrow keys</li>
7171
<li>Toggle folders (press spacebar)</li>
72-
<li>Rename (press enter, only allowed on items in 'Categories')</li>
72+
<li>
73+
Rename (press enter, only allowed on items in {"'"}Categories{"'"}
74+
)
75+
</li>
7376
<li>Create a new item (press A)</li>
7477
<li>Create a new folder (press shift+A)</li>
7578
<li>Delete items (press delete)</li>

packages/showcase/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { NextPage } from "next";
22
import Image from "next/image";
33
import Head from "next/head";
44
import Link from "next/link";
5-
import styles from "../styles/home.module.css";
5+
import styles from "../styles/Home.module.css";
66

77
const Home: NextPage = () => {
88
return (

0 commit comments

Comments
 (0)