Skip to content

Commit

Permalink
feat: expose internal render methods and hooks (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbach committed Jan 18, 2024
1 parent a6a2006 commit 4b14e11
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion next-release-notes.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
### Bug Fixes and Improvements
- Maintain original item order when dropping items (#315)
- Maintain original item order when dropping items (#315)
- Expose some hooks and internally used components in the public API that were hidden before (#313)
10 changes: 10 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { TreeItemElement } from './treeItem/TreeItemElement';
import { TreeItemChildren } from './treeItem/TreeItemChildren';

export * from './controlledEnvironment/ControlledTreeEnvironment';
export * from './tree/Tree';
export * from './uncontrolledEnvironment/UncontrolledTreeEnvironment';
export * from './uncontrolledEnvironment/StaticTreeDataProvider';
export * from './types';
export * from './renderers';
export * from './treeItem/useTreeItemRenderContext';
export * from './controlledEnvironment/useControlledTreeEnvironmentProps';

export const INTERNALS = {
TreeItemElement,
TreeItemChildren,
};
4 changes: 2 additions & 2 deletions packages/core/src/treeItem/TreeItemChildren.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { HTMLProps } from 'react';
import { TreeItem } from './TreeItem';
import { TreeItemElement } from './TreeItemElement';
import { TreeItemIndex } from '../types';
import { useTree } from '../tree/Tree';

Expand All @@ -14,7 +14,7 @@ export const TreeItemChildren = (props: {

for (const child of props.children) {
childElements.push(
<TreeItem key={child} itemIndex={child} depth={props.depth} />
<TreeItemElement key={child} itemIndex={child} depth={props.depth} />
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useTreeEnvironment } from '../controlledEnvironment/ControlledTreeEnvir
import { useTreeItemRenderContext } from './useTreeItemRenderContext';
import { TreeItemRenamingInput } from './TreeItemRenamingInput';

export const TreeItem = (props: {
export const TreeItemElement = (props: {
itemIndex: TreeItemIndex;
depth: number;
}): JSX.Element => {
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/treeItem/useTreeItemRenderContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ export const useTreeItemRenderContext = (item?: TreeItem) => {
},
'aria-hidden': true,
tabIndex: -1,
// TODO alternative interaction modes
};

const viewStateFlags = !viewState
Expand Down

0 comments on commit 4b14e11

Please sign in to comment.