@atlaskit/onboarding
Version:
An onboarding spotlight introduces new features to users through focused messages or multi-step tours.
84 lines (83 loc) • 2.65 kB
TypeScript
import React, { type ElementType, PureComponent, type ReactNode } from 'react';
import { type MemoizedFn } from 'memoize-one';
export type TargetRef = (element: HTMLElement | null | undefined) => void;
export type GetTargetRef = (
/**
* The `name` prop passed to the corresponding `SpotlightTarget`
*
* This is used as a key into the `targets` map owned by `SpotlightManager`
* because the `SpotlightManager` stores the target nodes for
* descendant `SpotlightTarget` instances.
*/
name: string) => TargetRef;
declare const TargetConsumer: React.Consumer<GetTargetRef | undefined>;
declare const SpotlightContext: React.Context<{
opened: () => void;
closed: () => void;
targets: {
[key: string]: HTMLElement | undefined;
};
}>;
declare const SpotlightStateConsumer: React.Consumer<{
opened: () => void;
closed: () => void;
targets: {
[key: string]: HTMLElement | undefined;
};
}>;
export { TargetConsumer };
export { SpotlightContext, SpotlightStateConsumer as SpotlightConsumer };
interface SpotlightManagerProps {
/**
* Boolean prop for toggling blanket transparency.
*/
blanketIsTinted?: boolean;
/**
* Typically the app, or a section of the app.
*/
children: ReactNode;
/**
* @deprecated
* Component is deprecated and will be removed in the future.
*/
component?: ElementType;
/**
* Handler function to be called when the blanket is clicked.
*/
onBlanketClicked?: () => void;
}
/**
* __Spotlight manager__
*
* A spotlight manager manages the visibility of spotlights used to introduce new features to users through focused messages or multi-step tours.
*
* - [Examples](https://atlassian.design/components/onboarding/examples)
* - [Code](https://atlassian.design/components/onboarding/code)
* - [Usage](https://atlassian.design/components/onboarding/usage)
*
* @deprecated Use `@atlaskit/spotlight` instead.
*/
export default class SpotlightManager extends PureComponent<SpotlightManagerProps, {
spotlightCount: number;
targets: {
[key: string]: HTMLElement | void;
};
}> {
static defaultProps: {
blanketIsTinted: boolean;
};
componentDidMount(): void;
state: {
spotlightCount: number;
targets: {};
};
getTargetRef: (name: string) => (element: HTMLElement | null | undefined) => void;
spotlightOpen: () => void;
spotlightClose: () => void;
getStateProviderValue: MemoizedFn<(this: any, targets: any) => {
opened: () => void;
closed: () => void;
targets: any;
}>;
render(): React.JSX.Element;
}