UNPKG

@atlaskit/tag

Version:

A tag labels UI objects for quick recognition and navigation.

44 lines (41 loc) • 1.62 kB
/* 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). */ var removableShrinkOutChildKey = 'atlaskit-tag-removable-shrink-out'; var motionWrapperStyles = null; // Props for the removable wrapper // Shared component for motion wrapper export function RemovableWrapper(_ref) { var isRemovable = _ref.isRemovable, status = _ref.status, onShrinkOutExitComplete = _ref.onShrinkOutExitComplete, children = _ref.children; if (isRemovable) { return /*#__PURE__*/React.createElement(ExitingPersistence, null, !(status === TagStatus.Removed) && /*#__PURE__*/React.createElement(ShrinkOut, { key: removableShrinkOutChildKey, onFinish: onShrinkOutExitComplete ? function (phase) { if (phase === 'exiting') { onShrinkOutExitComplete(); } } : undefined }, function (motion) { return /*#__PURE__*/React.createElement("span", { ref: motion.ref, className: ax(["_1e0c116y"]) }, children); })); } return children; }