@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
52 lines (51 loc) • 2.64 kB
TypeScript
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type React from 'react';
type SpotlightProviderProps = {
/** The app/screen content to wrap */
children: React.ReactNode;
/** A boolean that decides if there is a gray overlay when a spotlight is open. */
hasOverlay?: boolean;
/** If the overlay should be transparent */
isOverlayTransparent?: boolean;
};
type SpotlightContextType = {
/** A boolean that indicates if a spotlight is open */
isOpen: boolean;
/** A function that can be used to close or open the spotlight */
setIsOpen: (arg: boolean) => void;
/** A function that can be used to check if a spotlight is active. It takes a target id as an argument */
isActiveSpotlight: (target: string) => boolean;
/** A function that can be used to set a spotlight as active. It takes a target id as an argument, or null to clear the active spotlight */
setActiveSpotlight: (target: string | null) => void;
/** A function that can be used to register a target. It takes a target id, and a ref to the target element as arguments */
registerTarget: (id: string, ref: React.RefObject<HTMLElement>) => void;
/** A function that can be used to unregister a target. It takes a target id as an argument */
unregisterTarget: (id: string) => void;
/** An object that contains all registered targets. The keys are the target ids, and the values are the refs to the target elements */
registeredTargets: Record<string, React.RefObject<HTMLElement>>;
/** A boolean that decides if there is a gray overlay when a spotlight is open */
hasOverlay?: boolean;
};
export declare const SpotlightProvider: ({ children, hasOverlay, isOverlayTransparent, }: SpotlightProviderProps) => import("react/jsx-runtime").JSX.Element;
export declare const useSpotlightContext: () => SpotlightContextType;
export {};
//# sourceMappingURL=SpotlightProvider.d.ts.map