UNPKG

@atlaskit/editor-common

Version:

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

109 lines (107 loc) 5.69 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 _reactIntl = require("react-intl"); var _editorSharedStyles = require("@atlaskit/editor-shared-styles"); var _excluded = ["children"]; /* eslint-disable @atlaskit/ui-styling-standard/use-compiled -- Pre-existing lint debt surfaced by this mechanical type-import-only PR. */ /** * @jsxRuntime classic * @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic 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); } var messages = exports.messages = (0, _reactIntl.defineMessages)({ loading: { id: 'fabric.editor.expand.loading', defaultMessage: 'Loading...', description: 'Text shown inside an expand node while its content is being loaded, indicating to the user that data is still being fetched.' }, collapseNode: { id: 'fabric.editor.collapseNode', defaultMessage: 'Collapse content', description: 'The text is shown as a tooltip on a button when the user clicks to collapse an expand node in the editor, hiding its content.' }, expandDefaultTitle: { id: 'fabric.editor.expandDefaultTitle', defaultMessage: 'Click here to expand...', description: 'Placeholder text shown in the title field of an expand node when no title has been entered, prompting the user to click and expand the content.' }, expandNode: { id: 'fabric.editor.expandNode', defaultMessage: 'Expand content', description: 'The text is shown as a tooltip on a button when the user clicks to expand a collapsed expand node in the editor, revealing its content.' }, expandPlaceholderText: { id: 'fabric.editor.expandPlaceholder', defaultMessage: 'Give this expand a title...', description: 'Placeholder text for an expand node title input field' }, expandArialabel: { id: 'fabric.editor.expandAriaLabel', defaultMessage: 'Give this expand a title', description: 'aria label for an expand node title input field' }, expandBodyAriaLabel: { id: 'fabric.editor.expandBodyAriaLabel', defaultMessage: 'Expand body content', description: 'Aria label for the body content of an expand node' } }); 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, #292A2E)", borderRadius: "var(--ds-radius-small, 4px)", width: '24px', height: '24px', '&:hover': { background: "var(--ds-background-neutral-subtle-hovered, #0515240F)" }, // 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)(function (_ref2, ref) { var children = _ref2.children, otherProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded); return (0, _react2.jsx)("div", (0, _extends2.default)({ // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-explicit-any css: expandLayoutWrapperStyle, ref: ref // eslint-disable-next-line react/jsx-props-no-spreading -- Spreading otherProps to pass through HTML attributes (aria-*, data-*, event handlers, etc.) to the native div element }, otherProps), children); });