-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TreeView] Refacto the tree view internals to prepare for headless API
- Loading branch information
1 parent
ab83d35
commit cd5aaad
Showing
39 changed files
with
495 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
packages/x-tree-view/src/RichTreeView/RichTreeView.plugins.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as React from 'react'; | ||
import { | ||
ConvertPluginsIntoSignatures, | ||
MergeSignaturesProperty, | ||
TreeViewPublicAPI, | ||
} from '../internals/models'; | ||
import { useTreeViewId, UseTreeViewIdParameters } from '../internals/plugins/useTreeViewId'; | ||
import { | ||
useTreeViewItems, | ||
UseTreeViewItemsParameters, | ||
} from '../internals/plugins/useTreeViewItems'; | ||
import { | ||
useTreeViewExpansion, | ||
UseTreeViewExpansionParameters, | ||
} from '../internals/plugins/useTreeViewExpansion'; | ||
import { | ||
useTreeViewSelection, | ||
UseTreeViewSelectionParameters, | ||
} from '../internals/plugins/useTreeViewSelection'; | ||
import { | ||
useTreeViewFocus, | ||
UseTreeViewFocusParameters, | ||
} from '../internals/plugins/useTreeViewFocus'; | ||
import { useTreeViewKeyboardNavigation } from '../internals/plugins/useTreeViewKeyboardNavigation'; | ||
import { | ||
useTreeViewIcons, | ||
UseTreeViewIconsParameters, | ||
} from '../internals/plugins/useTreeViewIcons'; | ||
|
||
export const RICH_TREE_VIEW_PLUGINS = [ | ||
useTreeViewId, | ||
useTreeViewItems, | ||
useTreeViewExpansion, | ||
useTreeViewSelection, | ||
useTreeViewFocus, | ||
useTreeViewKeyboardNavigation, | ||
useTreeViewIcons, | ||
] as const; | ||
|
||
export type RichTreeViewSignatures = ConvertPluginsIntoSignatures<typeof RICH_TREE_VIEW_PLUGINS>; | ||
|
||
export type RichTreeViewPluginSlots = MergeSignaturesProperty<RichTreeViewSignatures, 'slots'>; | ||
|
||
export type RichTreeViewPluginSlotProps = MergeSignaturesProperty< | ||
RichTreeViewSignatures, | ||
'slotProps' | ||
>; | ||
|
||
// We can't infer this type from the plugin, otherwise we would lose the generics. | ||
export interface RichTreeViewPluginParameters<R extends {}, Multiple extends boolean | undefined> | ||
extends UseTreeViewIdParameters, | ||
UseTreeViewItemsParameters<R>, | ||
UseTreeViewExpansionParameters, | ||
UseTreeViewFocusParameters, | ||
UseTreeViewSelectionParameters<Multiple>, | ||
UseTreeViewIconsParameters {} | ||
|
||
export type RichTreeViewApiRef = React.MutableRefObject< | ||
TreeViewPublicAPI<RichTreeViewSignatures> | undefined | ||
>; |
Oops, something went wrong.