UNPKG

@atlaskit/editor-plugin-alignment

Version:

Alignment plugin for @atlaskit/editor-core

63 lines (61 loc) 2.36 kB
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */ import "./index.compiled.css"; import * as React from 'react'; import { ax, ix } from "@compiled/react/runtime"; import { injectIntl } from 'react-intl'; import { alignCenter, alignLeft, alignRight } from '@atlaskit/editor-common/keymaps'; import { alignmentMessages } from '@atlaskit/editor-common/messages'; import { IconMap } from '../ToolbarAlignment/icon-map'; import AlignmentButton from './AlignmentButton'; var alignmentWrapper = null; // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- This rule thinks this isn't a `css()` call due to the name mapping var alignmentWrapperStylesUnbounded = null; var alignCenterKeyboardShortcut = alignCenter; var alignRightKeyboardShortcut = alignRight; var alignmentOptions = [{ title: alignmentMessages.alignLeft, shortcut: alignLeft, value: 'start' }, { title: alignmentMessages.alignCenter, shortcut: alignCenterKeyboardShortcut, value: 'center' }, { title: alignmentMessages.alignRight, shortcut: alignRightKeyboardShortcut, value: 'end' }]; function Alignment(_ref) { var onClick = _ref.onClick, selectedAlignment = _ref.selectedAlignment, className = _ref.className, intl = _ref.intl; return /*#__PURE__*/React.createElement("div", { "data-testid": "alignment-buttons" // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 , // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 className: ax(["_1e0c1txw _ca0qze3t _n3tdze3t _19bvu2gc _u5f3u2gc _p12f1q5e _gy1pv77o", "_1fvdglyw", className]), style: { "--_4v9t68": ix("".concat(3 * 32 + 2 * 2, "px")) } }, alignmentOptions.map(function (alignment) { var value = alignment.value, title = alignment.title, shortcut = alignment.shortcut; var message = intl.formatMessage(title); return /*#__PURE__*/React.createElement(AlignmentButton, { content: /*#__PURE__*/React.createElement(IconMap, { alignment: value }), key: value, value: value, label: message, shortcut: shortcut, onClick: onClick, isSelected: value === selectedAlignment }); })); } var _default_1 = injectIntl(Alignment); export default _default_1;