@atlaskit/spotlight
Version:
A spotlight introduces users to points of interest, from focused messages to multi-step tours.
40 lines • 1.18 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 CrossIcon from '@atlaskit/icon/core/cross';
import { Pressable } from '@atlaskit/primitives/compiled';
import { SpotlightContext } from '../../controllers/context';
const styles = {
root: "_2rko1qi0 _1rjc12x7 _syaz15cr _bfhk1aqn _irr31ibz _1di6of27"
};
/**
* __SpotlightDismissControl__
*
* SpotlightDismissControl allows the user to close the `Spotlight`.
*
*/
export const SpotlightDismissControl = /*#__PURE__*/forwardRef(({
autoFocus = true,
onClick,
testId
}, ref) => {
const {
popoverContent
} = useContext(SpotlightContext);
const dismiss = event => {
popoverContent.dismiss.current(event);
};
return /*#__PURE__*/React.createElement(Pressable, {
autoFocus: autoFocus,
onClick: onClick || dismiss,
ref: ref,
testId: testId,
xcss: cx(styles.root),
"aria-label": "Dismiss"
}, /*#__PURE__*/React.createElement(CrossIcon, {
label: "Close"
}));
});