UNPKG

@atlaskit/editor-common

Version:

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

99 lines (97 loc) 4.61 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.messages = exports.expandLayoutWrapperStyle = exports.ExpandLayoutWrapperWithRef = exports.ExpandIconWrapper = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _react = _interopRequireWildcard(require("react")); var _react2 = require("@emotion/react"); var _reactIntlNext = require("react-intl-next"); var _editorSharedStyles = require("@atlaskit/editor-shared-styles"); var _excluded = ["children"]; /** * @jsxRuntime classic * @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } var messages = exports.messages = (0, _reactIntlNext.defineMessages)({ collapseNode: { id: 'fabric.editor.collapseNode', defaultMessage: 'Collapse content', description: 'Collapse the node' }, expandDefaultTitle: { id: 'fabric.editor.expandDefaultTitle', defaultMessage: 'Click here to expand...', description: 'Placeholder text for an expand node' }, expandNode: { id: 'fabric.editor.expandNode', defaultMessage: 'Expand content', description: 'Expand the node' }, expandPlaceholderText: { id: 'fabric.editor.expandPlaceholder', defaultMessage: 'Give this expand a title...', description: 'Placeholder text for an expand node title input field' } }); var ExpandIconWrapper = exports.ExpandIconWrapper = function ExpandIconWrapper(_ref) { var children = _ref.children, expanded = _ref.expanded; return (0, _react2.jsx)("div", { css: function css() { return expanded ? [expandIconWrapperStyle(), expandIconWrapperExpandedStyle] : expandIconWrapperStyle(); } }, children); }; var expandIconWrapperStyle = function expandIconWrapperStyle() { return (0, _react2.css)({ cursor: 'pointer', display: 'flex', color: "var(--ds-icon, #44546F)", borderRadius: "var(--ds-border-radius-100, 4px)", width: '24px', height: '24px', '&:hover': { background: "var(--ds-background-neutral-subtle-hovered, #091E420F)" }, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766 svg: { // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766 transition: "transform 0.2s ".concat(_editorSharedStyles.akEditorSwoopCubicBezier) } }); }; var expandIconWrapperExpandedStyle = (0, _react2.css)({ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766 svg: { transform: 'rotate(90deg)' } }); // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766 var expandLayoutWrapperStyle = exports.expandLayoutWrapperStyle = (0, _react2.css)({ width: "var(--ds-space-300, 24px)", height: "var(--ds-space-300, 24px)" }); var ExpandLayoutWrapperWithRef = exports.ExpandLayoutWrapperWithRef = /*#__PURE__*/(0, _react.forwardRef)( // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-explicit-any function (props, ref) { var children = props.children, rest = (0, _objectWithoutProperties2.default)(props, _excluded); return ( // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading (0, _react2.jsx)("div", (0, _extends2.default)({ css: expandLayoutWrapperStyle }, rest, { ref: ref }), children) ); });