@atlaskit/spotlight
Version:
A spotlight introduces users to points of interest, from focused messages to multi-step tours.
43 lines • 1.4 kB
JavaScript
/* index.tsx generated by @compiled/babel-plugin v3.0.2 */
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { forwardRef, useContext } from 'react';
import { cx } from '@atlaskit/css';
import { Pressable, Text } from '@atlaskit/primitives/compiled';
import { SpotlightContext } from '../../controllers/context';
const styles = {
root: "_2rko12b0 _syaz15cr",
outline: "_1dqonqa1 _189ee4h9 _1h6d8yml _bfhk1aqn _irr31ibz _1di6of27",
primary: "_1dqonqa1 _189ee4h9 _1h6da755 _bfhk1856 _irr3hf2y _1di6g6ey"
};
/**
* __Spotlight primary action__
*
* `SpotlightPrimaryAction` is required for all `Spotlight` components. It should be used to dismiss the spotlight
* for single step spotlights, or to show the next step on multi step spotlight tours.
*
*/
export const SpotlightPrimaryAction = /*#__PURE__*/forwardRef(({
'aria-label': ariaLabel,
onClick,
children,
appearance = 'outline',
testId
}, ref) => {
const {
primaryAction
} = useContext(SpotlightContext);
const done = event => {
primaryAction.action.current(event);
};
return /*#__PURE__*/React.createElement(Pressable, {
"aria-label": ariaLabel,
ref: ref,
testId: testId,
xcss: cx(styles.root, styles[appearance]),
onClick: onClick || done
}, /*#__PURE__*/React.createElement(Text, {
as: "span"
}, children));
});