@atlaskit/tag
Version:
A tag labels UI objects for quick recognition and navigation.
43 lines (40 loc) • 1.49 kB
JavaScript
/* removable-wrapper.tsx generated by @compiled/babel-plugin v3.0.2 */
/**
* Shared utilities for TagNew and AvatarTag components.
* Note: CSS styles cannot be shared due to Compiled CSS static analysis requirements.
*/
import "./removable-wrapper.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
import ShrinkOut from '@atlaskit/motion/shrink-out';
import { TagStatus } from './tag-status';
/**
* Stable key so ExitingPersistence can match this child across the remove transition
* (see ShrinkOut + ExitingPersistence docs in @atlaskit/motion).
*/
const removableShrinkOutChildKey = 'atlaskit-tag-removable-shrink-out';
const motionWrapperStyles = null;
// Props for the removable wrapper
// Shared component for motion wrapper
export function RemovableWrapper({
isRemovable,
status,
onShrinkOutExitComplete,
children
}) {
if (isRemovable) {
return /*#__PURE__*/React.createElement(ExitingPersistence, null, !(status === TagStatus.Removed) && /*#__PURE__*/React.createElement(ShrinkOut, {
key: removableShrinkOutChildKey,
onFinish: onShrinkOutExitComplete ? phase => {
if (phase === 'exiting') {
onShrinkOutExitComplete();
}
} : undefined
}, motion => /*#__PURE__*/React.createElement("span", {
ref: motion.ref,
className: ax(["_1e0c116y"])
}, children)));
}
return children;
}