@atlaskit/spotlight
Version:
A spotlight introduces users to points of interest, from focused messages to multi-step tours.
77 lines (76 loc) • 3.42 kB
JavaScript
/* index.tsx generated by @compiled/babel-plugin v3.0.2 */
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PopoverContent = void 0;
var React = _interopRequireWildcard(require("react"));
var _runtime = require("@compiled/react/runtime");
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _fg = require("@atlaskit/platform-feature-flags/fg");
var _legacy = require("./legacy");
var _topLayer = require("./top-layer");
var _excluded = ["children", "placement", "motion", "isVisible", "shouldDismissOnClickOutside", "dismiss", "back", "testId", "offset", "strategy"];
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); }
/**
* __PopoverContent__
*
* A `PopoverContent` is the element that is shown as a popover.
*/
var renderPopoverContent = function renderPopoverContent(Component, _ref) {
var children = _ref.children,
placement = _ref.placement,
motion = _ref.motion,
isVisible = _ref.isVisible,
shouldDismissOnClickOutside = _ref.shouldDismissOnClickOutside,
dismiss = _ref.dismiss,
back = _ref.back,
testId = _ref.testId,
offset = _ref.offset,
strategy = _ref.strategy,
actionProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
if ('next' in actionProps && actionProps.next) {
return /*#__PURE__*/React.createElement(Component, {
placement: placement,
motion: motion,
isVisible: isVisible,
shouldDismissOnClickOutside: shouldDismissOnClickOutside,
dismiss: dismiss,
back: back,
testId: testId,
offset: offset,
strategy: strategy,
next: actionProps.next
}, children);
}
if ('done' in actionProps && actionProps.done) {
return /*#__PURE__*/React.createElement(Component, {
placement: placement,
motion: motion,
isVisible: isVisible,
shouldDismissOnClickOutside: shouldDismissOnClickOutside,
dismiss: dismiss,
back: back,
testId: testId,
offset: offset,
strategy: strategy,
done: actionProps.done
}, children);
}
return /*#__PURE__*/React.createElement(Component, {
placement: placement,
motion: motion,
isVisible: isVisible,
shouldDismissOnClickOutside: shouldDismissOnClickOutside,
dismiss: dismiss,
back: back,
testId: testId,
offset: offset,
strategy: strategy
}, children);
};
var PopoverContent = exports.PopoverContent = function PopoverContent(props) {
return (0, _fg.fg)('platform-dst-top-layer-spotlight') ? renderPopoverContent(_topLayer.PopoverContent, props) : renderPopoverContent(_legacy.PopoverContent, props);
};