'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var clsx = require('clsx');
var React = require('react');
var reactTransitionGroup = require('react-transition-group');
var jsxRuntime = require('react/jsx-runtime');

const EXIT_ANIMATION = 350;
const SlidingPanel = /*#__PURE__*/React.forwardRef(({
  position = 'left',
  open,
  showSlidingPanelBorder,
  slidingPanelPositionFixed,
  className,
  children,
  testId,
  ...rest
}, reference) => {
  const localReference = React.useRef(null);
  React.useImperativeHandle(reference, () => localReference.current, []);
  return /*#__PURE__*/React.createElement(reactTransitionGroup.CSSTransition, {
    ...rest,
    key: `sliding-panel--open-${position}`,
    nodeRef: localReference,
    in: open
    // Wait for animation to finish before unmount.
    ,
    timeout: {
      enter: 0,
      exit: EXIT_ANIMATION
    },
    classNames: "sliding-panel",
    appear: true,
    unmountOnExit: true
  }, /*#__PURE__*/jsxRuntime.jsx("div", {
    ref: localReference,
    "data-testid": testId,
    className: clsx.clsx('sliding-panel', `sliding-panel--open-${position}`, showSlidingPanelBorder && `sliding-panel--border-${position}`, slidingPanelPositionFixed && 'sliding-panel--fixed', className),
    children: children
  }));
});

exports.EXIT_ANIMATION = EXIT_ANIMATION;
exports.default = SlidingPanel;
//# sourceMappingURL=SlidingPanel.js.map
