@atlaskit/spotlight
Version:
A spotlight introduces users to points of interest, from focused messages to multi-step tours.
39 lines • 1.35 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';
var styles = {
root: "_2rko1qi0 _1rjc12x7 _syaz15cr _bfhk1aqn _irr31ibz _1di6of27"
};
/**
* __SpotlightDismissControl__
*
* SpotlightDismissControl allows the user to close the `Spotlight`.
*
*/
export var SpotlightDismissControl = /*#__PURE__*/forwardRef(function (_ref, ref) {
var _ref$autoFocus = _ref.autoFocus,
autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
onClick = _ref.onClick,
testId = _ref.testId;
var _useContext = useContext(SpotlightContext),
popoverContent = _useContext.popoverContent;
var dismiss = function 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"
}));
});