mui-component
Version:
some custom mui components
34 lines (33 loc) • 1.25 kB
TypeScript
import PropTypes from "prop-types";
/**
* This hook registers our descendant by passing it into an array. We can then
* search that array by to find its index when registering it in the component.
* We use this for focus management, keyboard navigation, and typeahead
* functionality for some components.
*
* The hook accepts the element node
*
* Our main goals with this are:
* 1) maximum composability,
* 2) minimal API friction
* 3) SSR compatibility*
* 4) concurrent safe
* 5) index always up-to-date with the tree despite changes
* 6) works with memoization of any component in the tree (hopefully)
*
* * As for SSR, the good news is that we don't actually need the index on the
* server for most use-cases, as we are only using it to determine the order of
* composed descendants for keyboard navigation.
* @param descendant
*/
export declare function useDescendant(descendant: any): {
parentId: any;
index: number;
};
export declare function DescendantProvider(props: any): import("react/jsx-runtime").JSX.Element;
export declare namespace DescendantProvider {
var propTypes: {
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
id: PropTypes.Requireable<string>;
};
}