@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
63 lines (62 loc) • 2.77 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
/**
* @jsxRuntime classic
* @jsx jsx
*/
import React from 'react';
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
import { css, jsx } from '@emotion/react';
import { injectIntl } from 'react-intl-next';
import { Box, Text, xcss } from '@atlaskit/primitives';
import { messages } from './messages';
var captionWrapperStyle = css({
marginTop: "var(--ds-space-100, 8px)",
textAlign: 'center',
position: 'relative',
color: "var(--ds-text-subtle, #44546F)"
});
var placeholderStyle = xcss({
color: 'color.text.subtlest',
position: 'absolute',
top: 'space.0',
width: '100%'
});
// Ignored via go/ees005
// eslint-disable-next-line @repo/internal/react/no-class-components
export var CaptionComponent = /*#__PURE__*/function (_React$Component) {
function CaptionComponent() {
_classCallCheck(this, CaptionComponent);
return _callSuper(this, CaptionComponent, arguments);
}
_inherits(CaptionComponent, _React$Component);
return _createClass(CaptionComponent, [{
key: "render",
value: function render() {
var _this$props = this.props,
selected = _this$props.selected,
hasContent = _this$props.hasContent,
children = _this$props.children,
dataAttributes = _this$props.dataAttributes,
formatMessage = _this$props.intl.formatMessage;
var showPlaceholder = !selected && !hasContent;
return jsx("div", _extends({
"data-media-caption": true,
"data-testid": "media-caption"
// Ignored via go/ees005
// eslint-disable-next-line react/jsx-props-no-spreading
}, dataAttributes, {
css: captionWrapperStyle
}), showPlaceholder ? jsx(Box, {
xcss: placeholderStyle
}, jsx(Text, null, formatMessage(messages.placeholder))) : null, children);
}
}]);
}(React.Component);
export default injectIntl(CaptionComponent);