@atlaskit/spotlight
Version:
A spotlight introduces users to points of interest, from focused messages to multi-step tours.
47 lines (46 loc) • 2.49 kB
JavaScript
/* index.tsx generated by @compiled/babel-plugin v3.0.2 */
;
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SpotlightSecondaryAction = void 0;
require("./index.compiled.css");
var _react = _interopRequireWildcard(require("react"));
var React = _react;
var _runtime = require("@compiled/react/runtime");
var _fg = require("@atlaskit/platform-feature-flags/fg");
var _compiled = require("@atlaskit/primitives/compiled");
var _context = require("../../controllers/context");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var styles = {
root: "_2rko12b0 _v564k6bl _syaz15cr _bfhk1aqn _irr31ibz _1ggl5xtf _1di6of27",
rootMotion: "_2rko12b0 _v564k6bl _syaz15cr _bfhk1aqn _irr31ibz _1ggl5xtf _1di6of27"
};
/**
* __Spotlight secondary action__
*
* `SpotlightSecondaryAction` is not required for all spotlight components. It should supplement the `SpotlightPrimaryAction`.
* It is intended to be used to go back to the previous step in multi step spotlight tours, or other similar actions.
*
*/
var SpotlightSecondaryAction = exports.SpotlightSecondaryAction = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
var ariaLabel = _ref['aria-label'],
onClick = _ref.onClick,
children = _ref.children,
testId = _ref.testId;
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
secondaryAction = _useContext.secondaryAction;
var back = function back(event) {
secondaryAction.action.current(event);
};
return /*#__PURE__*/React.createElement(_compiled.Pressable, {
"aria-label": ariaLabel,
ref: ref,
testId: testId,
xcss: (0, _fg.fg)('platform-dst-motion-uplift-custom-button') ? styles.rootMotion : styles.root,
onClick: onClick || back
}, /*#__PURE__*/React.createElement(_compiled.Text, {
as: "span"
}, children));
});