Skip to content

Commit

Permalink
feature(react-tree): TreeRootReset component
Browse files Browse the repository at this point in the history
  • Loading branch information
bsunderhus committed Jan 16, 2025
1 parent 087380a commit ae648b8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feature: TreeRootReset component",
"packageName": "@fluentui/react-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feature: TreeRootReset component",
"packageName": "@fluentui/react-tree",
"email": "[email protected]",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions packages/react-components/react-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,7 @@ export {
useTreeItem_unstable,
useTreeStyles_unstable,
useTree_unstable,
TreeRootReset,
} from '@fluentui/react-tree';

export type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ export const TreeProvider: {
displayName: string;
};

// @public (undocumented)
export const TreeRootReset: (props: TreeRootResetProps) => JSX.Element;

// @public (undocumented)
export type TreeSelectionValue = MultiSelectValue | SingleSelectValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,13 @@ export const TreeProvider = (props: React.ProviderProps<TreeContextValue | Subtr
};

TreeProvider.displayName = 'TreeProvider';

export type TreeRootResetProps = {
children?: React.ReactNode;
};

export const TreeRootReset = (props: TreeRootResetProps) => (
<SubtreeContext.Provider value={undefined as unknown as SubtreeContextValue}>
{props.children}
</SubtreeContext.Provider>
);
2 changes: 1 addition & 1 deletion packages/react-components/react-tree/library/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export {

export type { FlatTreeSlots, FlatTreeProps, FlatTreeState } from './FlatTree';

export { TreeProvider } from './components/TreeProvider';
export { TreeProvider, TreeRootReset } from './components/TreeProvider';

export {
useTreeContext_unstable,
Expand Down

0 comments on commit ae648b8

Please sign in to comment.