@atlaskit/spotlight
Version:
A spotlight introduces users to points of interest, from focused messages to multi-step tours.
42 lines • 1.6 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';
var 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 var SpotlightPrimaryAction = /*#__PURE__*/forwardRef(function (_ref, ref) {
var ariaLabel = _ref['aria-label'],
onClick = _ref.onClick,
children = _ref.children,
_ref$appearance = _ref.appearance,
appearance = _ref$appearance === void 0 ? 'outline' : _ref$appearance,
testId = _ref.testId;
var _useContext = useContext(SpotlightContext),
primaryAction = _useContext.primaryAction;
var done = function 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));
});