@atlaskit/icon
Version:
An icon is a symbol representing a command, device, directory, or common action.
57 lines (56 loc) • 3.74 kB
JavaScript
/* ai-generative-text-summary.tsx generated by @compiled/babel-plugin v3.0.4 */
import _extends from "@babel/runtime/helpers/extends";
import "./ai-generative-text-summary.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors -- Animated glyphs are injected HTML strings, so inner elements can only be styled via nested selectors on the wrapper. */
import { forwardRef } from 'react';
import Icon from '../components/icon-new';
import { useAnimatedIconPlayback } from '../components/use-animated-icon-playback';
// Lines will scale (1 to 0) sequentially with the first line starting at 0ms and the last line ending at 450ms.
// Lines will scale (0 to 1) sequentially with the first line starting at 500ms and the last line ending at 950ms.
// Sparkle will scale (1 to 0.5) from 150ms-650ms and will scale back (0.5 to 1) from 650ms-1150ms.
// The direction of the lines is reversed on exit if the motion is interrupted while the lines are scaling back.
const TIMELINE = [{
phase: 'lines-exit-sparkle-shrink',
durationMs: 500
}, {
phase: 'lines-enter-sparkle-shrink',
durationMs: 150
}, {
phase: 'lines-enter-sparkle-enlarge',
durationMs: 500
}];
const animatedStyles = {
base: "_ejdb1e03 _12lu1ytf _1dm61h7a _4ymrlpop _1u5c1bs3 _1qbq12n9 _1ttv1229 _1xn71doz _1qp512n9 _wtan1yx9 _158po7wu _s7l01doz _vp6y12n9 _12sbfnf5 _1x47b6i5 _1qi61doz",
linesScaleDown: "_1qbq546l _1ttv1229 _1xn71doz _1qp5546l _158po7wu _s7l01doz _vp6y546l _1x47b6i5 _1qi61doz",
sparkleShrink: "_1dm61jia _e0rs6ebc _1u5c1bs3",
linesScaleUp: "_1ttv1sdz _158p1dpe _1x471mrq"
};
const glyph = `
<path data-anim="line0" d="M15 2v1.5H1V2z" fill="currentColor"/>
<path data-anim="line1" d="M9.5 7.25v1.5H1v-1.5z" fill="currentColor"/>
<path data-anim="line2" d="M6 12.5V14H1v-1.5z" fill="currentColor"/>
<path data-anim="sparkle" d="M12.5 9a.75.75 0 0 1 .71.49l.61 1.69 1.69.62a.75.75 0 0 1 .49.7l-.01.12a.75.75 0 0 1-.48.59l-1.69.61-.61 1.69a.75.75 0 0 1-.59.48l-.12.01a.75.75 0 0 1-.7-.49l-.61-1.69-1.69-.61a.75.75 0 0 1-.48-.59L9 12.5a.75.75 0 0 1 .49-.7l1.69-.61.62-1.69a.75.75 0 0 1 .59-.48z" fill="currentColor" style="transform-origin: 12.5px 12.5px;"/>
`;
/**
* Animated AI summary icon: the lines collapse and return while the sparkle shrinks and re-enlarges.
*/
const AiGenerativeTextSummaryAnimatedIcon = /*#__PURE__*/forwardRef(function AiGenerativeTextSummaryAnimatedIcon(props, ref) {
const [phases, lastPhase] = useAnimatedIconPlayback(ref, TIMELINE);
// If the motion is interrupted while the lines are entering, keep the entering transform origins so they
// finish scaling back from the right place.
const wasInterruptedWhileEntering = phases === undefined && (lastPhase === 'lines-enter-sparkle-shrink' || lastPhase === 'lines-enter-sparkle-enlarge');
return /*#__PURE__*/React.createElement("span", {
className: ax([animatedStyles.base, phases === 'lines-exit-sparkle-shrink' && animatedStyles.linesScaleDown, (phases === 'lines-enter-sparkle-enlarge' || phases === 'lines-enter-sparkle-shrink') && animatedStyles.linesScaleUp, (phases === 'lines-enter-sparkle-shrink' || phases === 'lines-exit-sparkle-shrink') && animatedStyles.sparkleShrink, wasInterruptedWhileEntering && animatedStyles.linesScaleUp])
}, /*#__PURE__*/React.createElement(Icon, _extends({
name: "AiGenerativeTextSummaryIcon",
dangerouslySetGlyph: glyph,
isAnimatedIcon: true
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
}, props, {
size: "medium"
})));
});
AiGenerativeTextSummaryAnimatedIcon.displayName = 'AiGenerativeTextSummaryIcon';
export default AiGenerativeTextSummaryAnimatedIcon;