@postenbring/hedwig-react
Version:
React components for [Hedwig Design System](https://github.com/bring/hedwig-design-system).
32 lines • 1.46 kB
TypeScript
import * as React from "react";
import type { ReactNode } from "react";
/**
* Merges an array of refs into a single memoized callback ref or `null`.
* @see https://floating-ui.com/docs/useMergeRefs
*/
export declare function useMergeRefs<Instance>(refs: (React.Ref<Instance> | undefined)[]): React.RefCallback<Instance> | null;
export declare function useResize<Instance extends HTMLElement>(ref: React.RefObject<Instance> | undefined | null): {
width: number;
height: number;
};
export declare function useHydrated(): boolean;
export declare function getValidationMessageValue(validationMessage?: ReactNode | {
value: ReactNode;
}, errorMessage?: ReactNode): ReactNode;
/**
* Trap focus inside an element using the `inert` attribute.
*
* Adds `inert` to all siblings of the given element, and all their ancestors up to the body.
* Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.
*
* NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert
* @see https://web.dev/articles/inert
*/
export declare function focusTrap(element: HTMLElement): () => void;
/**
* Returns the inert prop value based on the React version.
*/
export declare const inertPropValue: (x: boolean) => boolean | "" | undefined;
//# sourceMappingURL=utils.d.ts.map