UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

35 lines 1.5 kB
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["referenceElement", "placement"]; import React from 'react'; import { SpotlightCard } from '@atlaskit/onboarding'; import { Popper } from '@atlaskit/popper'; /* * ButtonSpotlightCard is an editor custom spotlight that renders next to a floating toolbar button. * It is built on top of the SpotlightCard component from @atlaskit/onboarding. * It avoids the issue of the native atlaskit Spotlight component rendering outside the editor bounds and takes focus away from the editor. */ export var ButtonSpotlightCard = function ButtonSpotlightCard(props) { var referenceElement = props.referenceElement, _props$placement = props.placement, placement = _props$placement === void 0 ? 'top-start' : _props$placement, spotlightCardProps = _objectWithoutProperties(props, _excluded); return /*#__PURE__*/React.createElement(Popper, { referenceElement: referenceElement, placement: placement, strategy: "absolute" }, function (_ref) { var ref = _ref.ref, style = _ref.style; return ( /*#__PURE__*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop React.createElement("div", { ref: ref, style: style }, /*#__PURE__*/React.createElement(SpotlightCard // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading , spotlightCardProps)) ); }); };