@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
83 lines (82 loc) • 3.39 kB
JavaScript
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";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
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, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
import { css, jsx, keyframes } from '@emotion/react';
var pulseBackground = keyframes({
'50%': {
backgroundColor: "var(--ds-blanket-danger, #EF5C4814)"
}
});
var pulseBackgroundReverse = keyframes({
'0%': {
backgroundColor: "var(--ds-blanket-danger, #EF5C4814)"
},
'50%': {
backgroundColor: 'auto'
},
'100%': {
backgroundColor: "var(--ds-blanket-danger, #EF5C4814)"
}
});
var flashWrapper = css({
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
'&.-flash > div': {
animationName: pulseBackgroundReverse,
animationDuration: '0.25s',
animationTimingFunction: 'ease-in-out'
},
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
'& > div': {
animation: "'none'"
}
});
var flashWrapperAnimated = css(_defineProperty({}, "".concat(flashWrapper, " & > div"), {
animationName: pulseBackground,
animationDuration: '0.25s',
animationTimingFunction: 'ease-in-out'
}));
// Ignored via go/ees005
// eslint-disable-next-line @repo/internal/react/no-class-components
var WithFlash = /*#__PURE__*/function (_React$Component) {
function WithFlash() {
var _this;
_classCallCheck(this, WithFlash);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, WithFlash, [].concat(args));
_defineProperty(_this, "toggle", false);
return _this;
}
_inherits(WithFlash, _React$Component);
return _createClass(WithFlash, [{
key: "render",
value: function render() {
var _this$props = this.props,
animate = _this$props.animate,
children = _this$props.children;
this.toggle = animate && !this.toggle;
return (
// eslint-disable-next-line @atlaskit/design-system/prefer-primitives
jsx("div", {
css: animate ? flashWrapperAnimated : flashWrapper
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
,
className: this.toggle ? '-flash' : ''
}, children)
);
}
}]);
}(React.Component);
export { WithFlash as default };