UNPKG

@atlaskit/editor-plugin-paste-options-toolbar

Version:

Paste options toolbar for @atlaskit/editor-core

46 lines (43 loc) 1.77 kB
/* PasteOptionsDropdownButton.tsx generated by @compiled/babel-plugin v0.39.1 */ import { ax, ix } from "@compiled/react/runtime"; import React, { useCallback } from 'react'; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 import DropdownMenu from '@atlaskit/dropdown-menu'; import { ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar'; /** * A compact dropdown button for paste options, styled like floating toolbar buttons. * Renders as a ToolbarButton with an icon and dropdown caret that opens a * dropdown menu below. Used when AI actions are not visible and the paste * options menu is the only content. */ export var PasteOptionsDropdownButton = function PasteOptionsDropdownButton(_ref) { var children = _ref.children, elemBefore = _ref.elemBefore, elemAfter = _ref.elemAfter, label = _ref.label, testId = _ref.testId, tooltipContent = _ref.tooltipContent; var trigger = useCallback(function (triggerProps) { var button = /*#__PURE__*/React.createElement(ToolbarButton, { ref: triggerProps.triggerRef, isSelected: triggerProps.isSelected, "aria-expanded": triggerProps['aria-expanded'], "aria-haspopup": triggerProps['aria-haspopup'], onClick: triggerProps.onClick, testId: testId, iconBefore: elemBefore, label: label }, elemAfter); if (tooltipContent) { return /*#__PURE__*/React.createElement(ToolbarTooltip, { content: tooltipContent, position: "top" }, button); } return button; }, [testId, elemBefore, elemAfter, label, tooltipContent]); return /*#__PURE__*/React.createElement(DropdownMenu, { placement: "bottom-start", trigger: trigger }, children); };