@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
69 lines (68 loc) • 2.25 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/defineProperty";
/**
* @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';
const pulseBackground = keyframes({
'50%': {
backgroundColor: "var(--ds-blanket-danger, #EF5C4814)"
}
});
const pulseBackgroundReverse = keyframes({
'0%': {
backgroundColor: "var(--ds-blanket-danger, #EF5C4814)"
},
'50%': {
backgroundColor: 'auto'
},
'100%': {
backgroundColor: "var(--ds-blanket-danger, #EF5C4814)"
}
});
const 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'"
}
});
const flashWrapperAnimated = css({
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
[`${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
export default class WithFlash extends React.Component {
constructor(...args) {
super(...args);
_defineProperty(this, "toggle", false);
}
render() {
const {
animate,
children
} = this.props;
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)
);
}
}