@atlaskit/icon
Version:
An icon is a symbol representing a command, device, directory, or common action.
48 lines • 2.68 kB
JavaScript
/* ai-search.tsx generated by @compiled/babel-plugin v3.0.4 */
import _extends from "@babel/runtime/helpers/extends";
import "./ai-search.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';
// Lens will scale (1 to 1.2) from 0-300ms and will scale back from 300ms-600ms
// Sparkle will scale (1 to 1.3 scale) from 60ms-360ms and will scale back from 360ms-660ms
const TIMELINE = [{
phase: 'lens-sparkle-grow',
durationMs: 300
},
// Lens and sparkle scale up
{
phase: 'sparkle-grow',
durationMs: 60
} // Sparkle continues to scale, whilst lens returns
];
const animatedStyles = {
base: "_ejdb1e03 _12lu1ytf _1lbi188d _f3xr1h7a _1dm61h7a",
lensGrow: "_f3xr3swd _1u1m188d",
sparkleGrow: "_1dm619xa _e0rs1ja5 _1u5c188d"
};
const glyph = `
<path data-anim="lens" d="M6 2.612A4.501 4.501 0 0 0 7 11.5a4.48 4.48 0 0 0 3.182-1.318A4.5 4.5 0 0 0 11.387 8h1.53a6 6 0 0 1-1.179 2.678l3.292 3.292-1.06 1.06-3.292-3.292A6 6 0 1 1 6 1.084z" fill="currentColor" style="transform-origin: 8px 7.5px;"/>
<path data-anim="sparkle" d="M14 3.25a.75.75 0 0 1-.493.705l-1.285.469a.5.5 0 0 0-.298.298l-.469 1.285a.75.75 0 0 1-1.41 0l-.469-1.285a.5.5 0 0 0-.298-.298l-1.285-.469a.75.75 0 0 1-.484-.589L7.5 3.25l.009-.116a.75.75 0 0 1 .484-.59l1.285-.468a.5.5 0 0 0 .298-.298l.469-1.285.049-.106A.75.75 0 0 1 10.749 0l.116.009a.75.75 0 0 1 .541.378l.05.106.468 1.285a.5.5 0 0 0 .298.298l1.285.469A.75.75 0 0 1 14 3.25" fill="currentColor" style="transform-origin: 10.75px 3.25px;"/>
`;
/**
* Animated AI search icon: the lens and sparkle scale up.
*/
const AiSearchAnimatedIcon = /*#__PURE__*/forwardRef(function AiSearchAnimatedIcon(props, ref) {
const [phase] = useAnimatedIconPlayback(ref, TIMELINE);
return /*#__PURE__*/React.createElement("span", {
className: ax([animatedStyles.base, phase === 'lens-sparkle-grow' && animatedStyles.lensGrow, (phase === 'lens-sparkle-grow' || phase === 'sparkle-grow') && animatedStyles.sparkleGrow])
}, /*#__PURE__*/React.createElement(Icon, _extends({
name: "AiSearchIcon",
dangerouslySetGlyph: glyph,
isAnimatedIcon: true
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
}, props, {
size: "medium"
})));
});
AiSearchAnimatedIcon.displayName = 'AiSearchIcon';
export default AiSearchAnimatedIcon;